<?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 Re: why my output file does not inlcude relative risk in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256214#M49060</link>
    <description>&lt;P&gt;Tagsets generates an XML file and you can add more sheets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each proc outputs a bunch of tables. The tables are documented. Find the name of the table you want and save that using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods table relativerisk=rr_out;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add this Before the proc. I'm not sure what the table name is, you'll have to confirm that. Either reference docs or use ODS TRACE to find the table names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Export the RR_out file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As always, get it working outside of the macro first.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 20:52:32 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-03-11T20:52:32Z</dc:date>
    <item>
      <title>why my output file does not inlcude relative risk</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256197#M49053</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*part I. use proc freq to calculate crude relative risk and 95%Ci;

	data question;
        input BIG $ Response $ Count;
        datalines;
GR   Yes 2256
    GR   No 212766

SM Yes 10450
     SM No 356115
     
      ;
%macro rr(PAT);
title1 "RR of &amp;amp;PAT";
proc freq data=question order=data ;
        weight Count;
        tables BIG*Response / relrisk OUT=RR;
        run;
proc export data = RR
outfile = "c:\TABLES"
dbms = XLSX replace;
sheet = "1.11.&amp;amp;PAT";
run;
%mend;

%rr(RED);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to calculate Relative risks of many groups. This is one of groups. So I use macro.&lt;/P&gt;&lt;P&gt;I want to output the result to a file so that I need NOT to copy and paste the result review of sas each time.&lt;/P&gt;&lt;P&gt;The above code did get relative risk of the group. However, the tables it generates lacks the relative risk that I need&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 19:41:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256197#M49053</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-03-11T19:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: why my output file does not inlcude relative risk</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256203#M49056</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data isn't being stored in your output file so you need to find the ODS table name and store it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The process is described here. Store the new table name and export the table.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://statgeeks.wordpress.com/2013/08/11/how-do-i-get-my-sas-results-into-a-data-set/" target="_blank"&gt;https://statgeeks.wordpress.com/2013/08/11/how-do-i-get-my-sas-results-into-a-data-set/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I recommend using Tagsets instead so you don't have to export data.&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token macrobound"&gt;%macro&lt;/SPAN&gt; rr&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;PAT&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
title1 &lt;SPAN class="token string"&gt;"RR of &amp;amp;PAT"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;freq&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;question order&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="token statement"&gt;weight&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;Count&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="token keyword"&gt;tables&lt;/SPAN&gt; BIG&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;Response &lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt; relrisk OUT&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;RR&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token macrobound"&gt;%mend&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;ods tagsets.excelxp file='sample.xml' style=meadow; &lt;BR /&gt;%rr(Pat);&lt;BR /&gt; %rr(Sec); &lt;BR /&gt;%rr(Third); &lt;BR /&gt;ods tagsets.excelxp close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 20:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256203#M49056</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-11T20:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: why my output file does not inlcude relative risk</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256209#M49058</link>
      <description>&lt;P&gt;my computer cannot access the link you provided.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used your code, but still I cannot generate a desired file. The file genrated is not a typical excel file. there is no relative risk there&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data question;
        input big $ Response $ Count;
        datalines;
gr   Yes 5
 gr  No 294

sm Yes 18522
    sm No 779090
     
      ;
%macro rr(ser);
title1 "RR of &amp;amp;ser";
proc freq data=question order=data ;
        weight Count;
        tables big*Response / relrisk OUT=RR;
        run;


ods tagsets.excelxp file='c:\TABLES11 &amp;amp;ser' style=meadow; 

run;
%mend;
%rr(bwlow hs);
%mend;
ods tagsets.excelxp 
close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;that I expect&lt;/P&gt;&lt;P&gt;plus, ideally i would like an excel file that I can always add more pages, instead of a single file&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 20:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256209#M49058</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-03-11T20:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: why my output file does not inlcude relative risk</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256214#M49060</link>
      <description>&lt;P&gt;Tagsets generates an XML file and you can add more sheets.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each proc outputs a bunch of tables. The tables are documented. Find the name of the table you want and save that using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods table relativerisk=rr_out;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add this Before the proc. I'm not sure what the table name is, you'll have to confirm that. Either reference docs or use ODS TRACE to find the table names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Export the RR_out file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As always, get it working outside of the macro first.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 20:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-my-output-file-does-not-inlcude-relative-risk/m-p/256214#M49060</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-11T20:52:32Z</dc:date>
    </item>
  </channel>
</rss>

