BookmarkSubscribeRSS Feed
ChuksManuel
Pyrite | Level 9

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 

1 REPLY 1
Reeza
Super User
Show what you expect as output.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 356 views
  • 0 likes
  • 2 in conversation