SAS program template created by SapMaker Table 3.4 for Table of Laboratory Exam: Abnormality – Example One. Please comment on it or post your other SAS code for table of Laboratory Exam: Abnormality.
***************************************************************************************
*** Program Purpose: Create Table LAB 2 – Abnormality of Laboratory Exams
*** SAS Dataset Used: , LB
*** Date of Program Created: 8/18/2010
*** Programmer: SapMaker
***************************************************************************************;
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);
%SumIncidentCatVar(
VarName=ANYLBIND,
VarLabel=%bquote(Any Abnormality of Lab Test),
CategoryName=%bquote(Y),
CategoryFormat=%str(),
CategoryOrder=%str(1),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=LB,
OutDataset=Sum_ANYLBIND,
OutVariable=%str(LabelCol_1),
Usubjid=USUBJID,
DatasetOrder=1
);
%SumIncidentCatVar(
VarName=CHEMABNIND,
VarLabel=%bquote(Abnormality of Chemistry Test),
CategoryName=%bquote(AST (SGOT), ALT (SGPT), Calcium, Sodium, Potassium, Glucose),
CategoryFormat=%str(3.0, 3.0, 3.0, 3.0, 3.0, 3.0),
CategoryOrder=%str(1, 2, 3, 4, 5, 6),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=LB,
OutDataset=Sum_CHEMABNIND,
OutVariable=%str(LabelCol_1),
Usubjid=USUBJID,
DatasetOrder=2
);
%SumIncidentCatVar(
VarName=HEMAABNIND,
VarLabel=%bquote(Abnormality of Hematology Test),
CategoryName=%bquote(Hemoglobin, Hematocrit, Neutrophils, RBC, Platelets, WBC, Lymphocytes),
CategoryFormat=%str(3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0),
CategoryOrder=%str(1, 2, 3, 4, 5, 6, 7),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=LB,
OutDataset=Sum_HEMAABNIND,
OutVariable=%str(LabelCol_1),
Usubjid=USUBJID,
DatasetOrder=3
);
%SumIncidentCatVar(
VarName=URINABNIND,
VarLabel=%bquote(Abnormality of Urinalysis Test),
CategoryName=%bquote(Protein, Glucose, Ketones, RBC, WBC, Urine pH),
CategoryFormat=%str(3.0, 3.0, 3.0, 3.0, 3.0, 3.0),
CategoryOrder=%str(1, 2, 3, 4, 5, 6),
Treatment=TRTGRPC,
ByGroup=%str(),
Population=,
CohortDataset=,
AnalysisDataset=LB,
OutDataset=Sum_URINABNIND,
OutVariable=%str(LabelCol_1),
Usubjid=USUBJID,
DatasetOrder=4
);
data Sum_ANYLBIND;
merge Sum_ANYLBIND Test_ANYLBIND;
by _setorder _varorder;
run;
data Sum_CHEMABNIND;
merge Sum_CHEMABNIND Test_CHEMABNIND;
by _setorder _varorder;
run;
data Sum_HEMAABNIND;
merge Sum_HEMAABNIND Test_HEMAABNIND;
by _setorder _varorder;
run;
data Sum_URINABNIND;
merge Sum_URINABNIND Test_URINABNIND;
by _setorder _varorder;
run;
data rptSet;
set
Sum_ANYLBIND
Sum_CHEMABNIND
Sum_HEMAABNIND
Sum_URINABNIND
;
run;
*** Proc Printto file =” ” new; run;
title1 “Table LAB 2”;
title2 “Abnormality of Laboratory Exams”;
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 ;
define _setorder / order order=data noprint;
define LabelCol_1 / display width=37 left flow “Abnormality of Laboratory Test, n(%)#__”;
break after _setorder / skip suppress;
run;
Proc Printto; run;