BookmarkSubscribeRSS Feed
alexgouv
Obsidian | Level 7

Hi all,

 

I am having a small problem with my odds ratios which I am generating from proc freq. They are giving me the inverse of what I want and I cannot figure out how to flip them. Right now I am comparing Treatment to Outcome while adjusting for Type. It is giving me the Odds Ratios for TRT to Outcome, when I want Outcome to TRT. Any ideas on how to flip them? I have tried flipping them in the tables statement and changing the order of the data but no luck. Here's the code I'm currently using:

 

proc freq data = p1 order = data;
	weight count;
	tables od*trt*out / 
			chisq expected nocol measures cmh alpha=.1 out = test;
run;

 

I just want to flip it so I don't have to calculate confidence intervals manually, so if this can't be done or is very complicated let me know.

 

Thanks!

2 REPLIES 2
SAS_Rob
SAS Employee

I am not sure I understand what you mean by your comment about flipping the variables.  In general, your outcome variable should be the column, that is, the last variable on the TABLES statement, with the level of interest in the first column.  Your row variable would be ordered such that the row1 level will be compared against the row2 level in the odds ratio.

 

You should be able to control the ordering of the rows and columns by using the ORDER= option.  The easiest thing to do is to set up formats that properly reflect the ordering and use the ORDER=FORMATTED option.

ballardw
Super User

Data? Values?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1747 views
  • 0 likes
  • 3 in conversation