BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
deme_bb
Fluorite | Level 6

I am trying to obtain crude OR and their relevant CIs for several variable using the procfreq tables function; however, the statement is not giving me odds ratios.

Proc Freq data=df_epi ;
tables age * Stroke / cmh;
run;

 

I obtained the adjusted OR using this code.

Proc Logistic data=df_epi;
class educ ;
model Stroke (Event='1') = educ Age bmi diabetes prevchd prevhyp sysbp diabp glucose totchol heartrte;
run;

 

Help please

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

@deme_bb wrote:

What do you mean by "fix the class statement"?

Not sure how familiar you are with PROC LOGISTIC and logistic regression, but you may also want to specify PARAM=REF on the CLASS statement to get referential parameterization of your dummy variables, the default is GLM.



SO my unadjusted odds ratio would be me running that statement with each individual variable separately?


. So if you run a logistic regression with a single variable that would be the crude rate.

View solution in original post

8 REPLIES 8
Reeza
Super User

From the documentation:

 

CMH

Requests all Cochran-Mantel-Haenszel statistics

CMH1

Requests CMH correlation statistic, adjusted odds ratios,

 

and adjusted relative risks

CMH2

Requests CMH correlation and row mean scores (ANOVA)

 

statistics, adjusted odds ratios, and adjusted relative risks

 

or 

 

OR

Requests the odds ratio for  tables

 

You haven't used an option that would provide OR, change your code by adding one of the following options instead and see if you get what you need. 

 

https://documentation.sas.com/?docsetId=procstat&docsetTarget=procstat_freq_syntax08.htm&docsetVersi...

 

If your table is not a 2x2 table, this gets a bit trickier and you're likely better off just using PROC LOGISTIC to get the unadjusted rates. 

 

Not sure how familiar you are with PROC LOGISTIC and logistic regression, but you may also want to specify PARAM=REF on the CLASS statement to get referential parameterization of your dummy variables, the default is GLM.


@deme_bb wrote:

I am trying to obtain crude OR and their relevant CIs for several variable using the procfreq tables function; however, the statement is not giving me odds ratios.

Proc Freq data=df_epi ;
tables age * Stroke / cmh;
run;

 

I obtained the adjusted OR using this code.

Proc Logistic data=df_epi;
class educ ;
model Stroke (Event='1') = educ Age bmi diabetes prevchd prevhyp sysbp diabp glucose totchol heartrte;
run;

 

Help please


 

deme_bb
Fluorite | Level 6

Hi Reeza,

My table is not a 2x2. Proc logistic would only give me the adjusted ratios correct? If it doe sindeed give me crude ratios im not sure on how to go about obtaining them.

Reeza
Super User
Crude ratio's mean you haven't adjusted for any other variables. So if you run a logistic regression with a single variable that would be the crude rate.
deme_bb
Fluorite | Level 6

Okay so maybe i have it backwards. How would i determine my adjusted ratios?

 

The code below is the code i used to obtain the unadjusted ratios:

Proc Logistic data=df_epi;
class educ ;
model Stroke (Event='1') = educ Age bmi diabetes prevchd prevhyp sysbp diabp glucose totchol heartrte;
run;

 

So how would i obtain the adjusted ratios?

Reeza
Super User
That is the adjusted ratios. Minus the fact you haven't fixed your class, unless you want that.
deme_bb
Fluorite | Level 6

What do you mean by "fix the class statement"?

SO my unadjusted odds ratio would be me running that statement with each individual variable separately?

Reeza
Super User

@deme_bb wrote:

What do you mean by "fix the class statement"?

Not sure how familiar you are with PROC LOGISTIC and logistic regression, but you may also want to specify PARAM=REF on the CLASS statement to get referential parameterization of your dummy variables, the default is GLM.



SO my unadjusted odds ratio would be me running that statement with each individual variable separately?


. So if you run a logistic regression with a single variable that would be the crude rate.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 8 replies
  • 2479 views
  • 2 likes
  • 2 in conversation