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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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