## Odds Ratio

Solved
Regular Contributor
Posts: 238

# Odds Ratio

I am not sure which of these columns is my odds ratio and what I would use for graphing. My CHISQ input is this:

PROC FREQ DATA = ReAdm.CHI2 ORDER = DATA; BY COMPARISON;

WEIGHT COUNT;

EXACT OR;

OUTPUT OUT = ReAdm.Final OR CHISQ;

RUN;

The table that houses the information is formatted like this and has 6508 total rows:

The pattern continues. The svrty_lvl_cd can be 0-4. The output after doing the above proc freq looks like this:

who                           svrty_lvl_cd               numinstratum                chi-sq                dfforchisq                  pvaludforchisq                likelihoodratiochisq           etc etc

1111                                 0                             43208               5.936074278                   1                        0.0148340237                     2.6000184059

2222                                 1                              8465                0.0004668797                 1                        0.9827611316                     0.0004696993

3333                                 2                             43211               2.1302468839                 1                        0.1444174938                     1.2836288201

I am thinking that my likelihood ratio chisq is what I use for the odds ratio for graphin. The National average is 3.69% however I am not positive what to use for the graphing to show the odds ratio. Any advice?

Accepted Solutions
Solution
‎04-19-2012 10:50 AM
SAS Super FREQ
Posts: 9,367

## Re: Odds Ratio

Hi:

In addition to Doc's suggestion, if you have SAS 9.2 or higher, then PROC FREQ can give you an automatic oddsratio plot if you do this:

TABLES ..... / plots=(oddsratioplot);

in your TABLE request and if ODS GRAPHICS ON; is in effect. So, you might get the plot you want without capturing the OR numbers and plotting them yourself. Look in the FREQ and ODS GRAPHICS doc for more info.

cynthia

All Replies
Posts: 2,125

## Re: Odds Ratio

I think that you are going to need to use the ODS output facility here.  The OUTPUT statement does not output the OR's for the CMH test; it just works on 2x2 tables (at least per the documentation).

Doc Muhlbaier

Duke

Regular Contributor
Posts: 238

## Re: Odds Ratio

What is the OR's for the CMH test? Does that mean my code is not right so I am not capturing the entire CHISQ test? And if so what do I need to put in and what do I need to get the odds ratio for graphing?

Solution
‎04-19-2012 10:50 AM
SAS Super FREQ
Posts: 9,367

## Re: Odds Ratio

Hi:

In addition to Doc's suggestion, if you have SAS 9.2 or higher, then PROC FREQ can give you an automatic oddsratio plot if you do this:

TABLES ..... / plots=(oddsratioplot);

in your TABLE request and if ODS GRAPHICS ON; is in effect. So, you might get the plot you want without capturing the OR numbers and plotting them yourself. Look in the FREQ and ODS GRAPHICS doc for more info.

cynthia

Regular Contributor
Posts: 238

## Re: Odds Ratio

Actually I did not need any altering of my proc freq. I read thru the ODS and proc freq for graphics posted by Cynthia and created a quick proc freq based on what it stated. It gave me an odds ratio for my list and I then went into the readm.final table created by my proc freq chisq statement and looked to see if any of those numbers matched. I have numerous columns and did not post them all in my original because there are too many columns. But one column that is output based on my proc freq is called odds ratio est relative to risk and I viewed the data in there along with the output from the code I ran for the ods graphics on and it matches. So that tells me this column houses my odds ratio that I needed for my graphs.

Thanks

🔒 This topic is solved and locked.

Discussion stats
• 4 replies
• 435 views
• 0 likes
• 3 in conversation