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;
TABLES SVRTY_LVL_CD*WHO*ADMISSION/CHISQ CMH FISHER EXPECTED;
EXACT OR;
OUTPUT OUT = ReAdm.Final OR CHISQ;
RUN;
The table that houses the information is formatted like this and has 6508 total rows:
comparison who svrty_lvl_cd admission count
1111 1111 0 admit 2
1111 1111 0 readmit 1
1111 national 0 admit 41296
1111 national 0 readmit 1909
2222 2222 1 admit 9
2222 2222 1 readmit 1
2222 national 1 admit 7592
2222 national 1 readmit 863
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?
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
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
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?
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
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
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.