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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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