Dear
I am using below proc freq code to find risk diff between treatments. Now I need to calculate stratified riskdiff. The stratification variable are age ss ph. Please suggest me how to update code. Thank you
data one;
input trt res$ age ss ph $;
datalines;
1 cr 55 1 Y
1 cr 53 1 N
1 cri 52 1 Y
1 cri 58 1 N
1 cri 50 2 N
1 cr 53 2 N
1 cri 52 2 Y
1 cri 58 2 N
2 cri 56 2 Y
2 cri 51 2 N
2 cr 50 2 Y
2 cr 56 2 N
;
proc freq data = one;
tables trt * res / riskdiff cl alpha = 0.025 ;
ods output riskdiffcol1 = rd (keep = control risk lowercl uppercl where = (control)) ;
run ;
/*
Sure you can add age in it ( if your data was enough to analysis ).
The following could get what you need.
*/
ods select none;
ods output CommonPdiff=CommonPdiff RiskDiffPlot=RiskDiffPlot;
proc freq data = one;
tables age*ss*ph* trt * res / riskdiff(common cl=wald) alpha = 0.025 ;
run ;
ods select all;
data one;
input trt res$ age ss ph $;
datalines;
1 cr 55 1 Y
1 cr 53 1 N
1 cri 52 1 Y
1 cri 58 1 N
1 cri 50 2 N
1 cr 53 2 N
1 cri 52 2 Y
1 cri 58 2 N
2 cri 56 2 Y
2 cri 51 2 N
2 cr 50 2 Y
2 cr 56 2 N
;
proc freq data = one;
tables ss*ph* trt * res / riskdiff(common cl=wald) alpha = 0.025 ;
run ;
Thank you for the help. Can i also include age in
tables ss*ph* trt * res / riskdiff(common cl=wald) alpha = 0.025 ;
tables statement. How to output dataset containing risk diff values. Thank you
/*
Sure you can add age in it ( if your data was enough to analysis ).
The following could get what you need.
*/
ods select none;
ods output CommonPdiff=CommonPdiff RiskDiffPlot=RiskDiffPlot;
proc freq data = one;
tables age*ss*ph* trt * res / riskdiff(common cl=wald) alpha = 0.025 ;
run ;
ods select all;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: