BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
knveraraju91
Barite | Level 11

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 ;
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
/*
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;

View solution in original post

3 REPLIES 3
Ksharp
Super User
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 ;

Ksharp_0-1671709477275.png

 

knveraraju91
Barite | Level 11

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

 

Ksharp
Super User
/*
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;

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1836 views
  • 1 like
  • 2 in conversation