BookmarkSubscribeRSS Feed
yogita_patel
Calcite | Level 5

Hello,

 

How to calculate or get odds ratio and relative risk for Overall response table. I have 2 treatment group.

I tried with proc freq, 

 


proc freq data=workorr;
by trt01pn mainord;
table ord / chisq relrisk;
weight count;
output chisq relrisk out=ratio;
run;

/****OR***/
ods listing close;
ods output cmh = relrto;

proc freq data=orr2 ;
by mainord ;
tables stratan*trt01pn*ord / cmh relrisk;
run;

 

But I am not getting in output dataset. I am only getting chi sq. value for first code and p value for second code.

 

I got risk diff. (RD) with below code.

 


ods trace on;
/*95% CI*/
proc freq data=workorr;
by trt01pn mainord ;
table ord / binomial ;
exact binomial;
weight count / zero ; /*add this for zero CI's*/
output binomial out=orr_ ;
RUN;
ods trace off;

 

please let me know if I am missing something or doing something wrong.

Thanks you.

 

2 REPLIES 2
quickbluefish
Barite | Level 11
Not sure exactly which ones, but I would recommend you google "PROC FREQ ODS TABLE NAMES" and look there for relrisk and OR-related things.
Ksharp
Super User

OR and RR are all for 2x2 contingency table, so you need 2 category variables with 2 levels to calculated them.
https://support.sas.com/kb/23/003.html

 

Ksharp_0-1735981531762.png

 

 



For high dimension contingency table:

Ksharp_1-1735981648718.png

 

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
  • 2 replies
  • 911 views
  • 0 likes
  • 3 in conversation