<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using Proc Freq in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-Freq/m-p/572291#M75328</link>
    <description>&lt;P&gt;Hello Proc experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please i need your input and help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My codes&amp;nbsp; 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 ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 04:02:57 GMT</pubDate>
    <dc:creator>ChuksManuel</dc:creator>
    <dc:date>2019-07-10T04:02:57Z</dc:date>
    <item>
      <title>Using Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-Freq/m-p/572291#M75328</link>
      <description>&lt;P&gt;Hello Proc experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please i need your input and help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My codes&amp;nbsp; 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 ).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 04:02:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-Freq/m-p/572291#M75328</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-07-10T04:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using Proc Freq</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-Freq/m-p/572400#M75333</link>
      <description>Show what you expect as output.</description>
      <pubDate>Wed, 10 Jul 2019 15:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-Proc-Freq/m-p/572400#M75333</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-10T15:13:00Z</dc:date>
    </item>
  </channel>
</rss>

