Hello Proc experts,
Please i need your input and help.
I have a dataset in which i want to use proc freq to get the percentage of patients who died for each value of my dichotomous heart complaint variable (0/1) and the odds ratio and 95% CI for heart complaint by died table.
I also want to merge (by tc tn) the odds ratio and 95%CI with the proportion who died to tell if there was any association between having the heart complaint and dying.
data me;
input Hear1 Heart2 Heart3 days chddeath death tc Tn $ value;
datalines;
0 1 1 629 0 1 1 Angina 0
0 1 1 629 0 1 2 Heartburn 1
0 1 1 629 0 1 3 Sleeplessness 0
1 0 1 1096 0 0 1 Angina 0
1 0 1 1096 0 0 2 Heartburn 0
1 0 1 1096 0 0 3 Sleeplessness 0
0 0 1 1096 0 0 1 Angina 0
0 0 1 1096 0 0 2 Heartburn 1
0 0 1 1096 0 0 3 Sleeplessness 0
1 0 1 1096 0 0 1 Angina 0
; run;
proc print; run;
/*sort dataset bt tc tn*/
proc sort data=two; by tc tn; run;
/*to get an output that has oddsratio and outpct*/
Proc freq data =two noprint ; by tc tn ;
Tables value*death/out=twoa outpct cmh;
proc print data = twoa; run;
/*to get an output that has only those that died*/
Proc freq data =two ; by tc tn ;
tables death/out=twob ; run;
data twob; set twob; if death = 1; run;
/*to merge both datasets*/
data three;
merge twoa twob;
by tc tn;
run;
My codes are as written above and it did not give me the desired output that i was looking for. Please how can i get the OR and 95% CI using this format (Proc freq and options ).
Thanks
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.