SAS program template created by SapMaker Table 3.4 for Table of Summary Demographics and Baseline Characteristics – Example One.
Please comment on it or post your other SAS code for table of summary of demographics and baseline characteristics.
***************************************************************************************
*** Program Purpose: Create Table DM 1 – Demographics (Format 1)
*** SAS Dataset Used: , DM
*** Date of Program Created: 8/18/2010
*** Programmer: SapMaker
***************************************************************************************;
libname sasmacro ‘C:\DEMO’;
options nonumber nodate nofmterr mlogic ls=132 ps=48;
option mstored sasmstore=sasmacro;
/** Count number of subjects in each treatment group and set it to macro variable npt1, npt2, etc. **/
%GroupCount(
CohortDataset=,
Treatment=TRTGRPC,
Usubjid=USUBJID);
%SumStatCntVar(
VarName=AGE,
VarLabel=%bquote(Age (year)),
SumStatName=%bquote(n, mean (SD), median, range),
SumStatFormat=%str(3.0, 2.0, 3.0, 3.0),
SumStatOrder=%str(1, 2, 3, 4),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=DM,
OutDataset=Sum_AGE,
OutVariable=%str(LabelCol_1),
DatasetOrder=1
);
%SumStatCatVar(
VarName=SEX,
VarLabel=%bquote(Sex),
CategoryName=%bquote(Male, Female),
CategoryFormat=%str(3.0),
CategoryOrder=%str(1, 2),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=DM,
OutDataset=Sum_SEX,
OutVariable=%str(LabelCol_1),
Usubjid=USUBJID,
DatasetOrder=2
);
%SumStatCatVar(
VarName=RACE,
VarLabel=%bquote(Race),
CategoryName=%bquote(Caucasian, Black, Hispanic, Asian, Other),
CategoryFormat=%str(3.0, 3.0, 3.0, 3.0, 3.0),
CategoryOrder=%str(1, 2, 3, 4, 5),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=DM,
OutDataset=Sum_RACE,
OutVariable=%str(LabelCol_1),
Usubjid=USUBJID,
DatasetOrder=3
);
%SumStatCntVar(
VarName=HEIGHT,
VarLabel=%bquote(Height (cm)),
SumStatName=%bquote(n, mean (SD), median, range),
SumStatFormat=%str(3.0, 3.0, 3.0, 3.0),
SumStatOrder=%str(1, 2, 3, 4),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=DM,
OutDataset=Sum_HEIGHT,
OutVariable=%str(LabelCol_1),
DatasetOrder=4
);
%SumStatCntVar(
VarName=WEIGHT,
VarLabel=%bquote(Weight (kg)),
SumStatName=%bquote(n, mean (SD), median, range),
SumStatFormat=%str(3.0, 5.1, 3.0, 3.0),
SumStatOrder=%str(1, 2, 3, 4),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=DM,
OutDataset=Sum_WEIGHT,
OutVariable=%str(LabelCol_1),
DatasetOrder=5
);
%SumStatCntVar(
VarName=BMI,
VarLabel=%bquote(Body Mass Index (kg/m^2)),
SumStatName=%bquote(n, mean (SD), median, range),
SumStatFormat=%str(3.0, 4.1, 3.0, 2.0),
SumStatOrder=%str(1, 2, 3, 4),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=DM,
OutDataset=Sum_BMI,
OutVariable=%str(LabelCol_1),
DatasetOrder=6
);
data rptSet;
set
Sum_AGE
Sum_SEX
Sum_RACE
Sum_HEIGHT
Sum_WEIGHT
Sum_BMI
;
run;
*** Proc Printto file =” ” new; run;
title1 “Table DM 1″;
title2 “Demographics (Format 1)”;
title3 “All Randomized Subjects”;
data _NULL_;
length ft $132.;
ft=%str(repeat(“_”, 132));
call symput(‘f1′, ft);
ft =%str(“Note: denominator of percentage is the number of subjects in the column”);
call symput(‘f2′, ft);
run;
footnote1 “&f1″;
footnote2 “&f2″;
Proc Report Data = rptSet split=”#” spacing =2 nowindows list headskip missing;
Column
_setorder LabelCol_1
( “Placebo#” Col_1 )
( “Dose 10 mg#” Col_2 )
( “Dose 100 mg#” Col_3 ) ;
define _setorder / order order=data noprint;
define LabelCol_1 / display width=30 left flow “Parameter /Summary Statistics#__”;
define Col_1 / display width=8 center “(N=%trim(%left(&npt1)))#__”;
define Col_2 / display width=11 center “(N=%trim(%left(&npt2)))#__”;
define Col_3 / display width=12 center “(N=%trim(%left(&npt3)))#__”;
break after _setorder / skip suppress;
run;
Proc Printto; run;