<?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: Problem calculating relative risk for multi-categorical exposure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-calculating-relative-risk-for-multi-categorical-exposure/m-p/890929#M352022</link>
    <description>&lt;P&gt;It looks like proc freq only does relative risk for 2x2 tables.&amp;nbsp; So you could create a dataset with a sequence of &lt;EM&gt;&lt;STRONG&gt;province pairs&lt;/STRONG&gt;&lt;/EM&gt;,&amp;nbsp; i.e. all the 'AB' and 'ON' observations (pair_num=1), then all the 'BC' and 'ON' observations (pair_num=2).&amp;nbsp; Then you could do a sequence of 2x2 tables&amp;nbsp; using PROC FREQ --&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;BY PAIR_NUM&lt;/STRONG&gt;&lt;/EM&gt;, as here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ON;
  set have (where=(province='ON'));
run;

data test ;
  set have (where=(province^='ON'));
  by province ;
  retain pairnum 0   pairing 'XX vs YY';
  if first.province then do;
    pairnum+1;
    pairing=catx(' ',province,'vs','ON');
  end;
  output;

  if last.province then do ptr=1 to n_on;
    set ON nobs=n_on point=ptr;
    output;
  end;
run;

proc freq data=test;
  by pairnum pairing;
  tables province*smm / nopercent nocol ;
  exact relrisk (column=2 method=noscore);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I used the "method=noscore" option because it is much faster than the default (method=score).&amp;nbsp; Take a look at the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/procstat/procstat_freq_syntax03.htm#procstat.freq.freqexrelrisk" target="_self"&gt;RELRISK &amp;lt;(options)&amp;gt;&lt;/A&gt;&amp;nbsp; section of the EXACT statement documentation.&amp;nbsp; If you have a lot of pairings to examine, you might want to test this on just a couple to get an idea of how long it will take to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And on another note, I don't know how much "confidence" one can have in a set of relrisk confidence limits when each set re-use the same province=ON data.&amp;nbsp; That's an estimation problem that I never had to face.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Aug 2023 01:27:02 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2023-08-25T01:27:02Z</dc:date>
    <item>
      <title>Problem calculating relative risk for multi-categorical exposure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-calculating-relative-risk-for-multi-categorical-exposure/m-p/890899#M352016</link>
      <description>&lt;P&gt;Hi, I am trying to calculate the relative risk of SMM per province and obtain different RR estimates for each province with ON as the reference.&lt;/P&gt;&lt;P&gt;My data looks something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Vivio_0-1692906541267.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/87055i1DB8251C298BED0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Vivio_0-1692906541267.png" alt="Vivio_0-1692906541267.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have tried different methods but none is working. Please help.&lt;/P&gt;&lt;P&gt;Method 1 using binomial does not give me separate RRs. I also saw somewhere about removing the "param" and estimate line but this did not work either, neither does using NLMeans macro.&lt;/P&gt;&lt;P&gt;proc genmod data= smm.uvu descending;&lt;BR /&gt;class province1(ref='ON')/ param=ref;&lt;BR /&gt;model SMM = province1/d=bin link=log;&lt;BR /&gt;estimate 'SMM RR by province' province1 1/exp;&lt;BR /&gt;lsmeans province1 / diff exp cl;&lt;BR /&gt;title "RR SMM type by province";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Method 2. The proc freq method below is only giving me 2*2 freq without any RR:&lt;/P&gt;&lt;P&gt;proc freq data=uvu2 order=data;&lt;BR /&gt;tables province1*SMM/relrisk;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 19:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-calculating-relative-risk-for-multi-categorical-exposure/m-p/890899#M352016</guid>
      <dc:creator>Vivio</dc:creator>
      <dc:date>2023-08-24T19:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem calculating relative risk for multi-categorical exposure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-calculating-relative-risk-for-multi-categorical-exposure/m-p/890929#M352022</link>
      <description>&lt;P&gt;It looks like proc freq only does relative risk for 2x2 tables.&amp;nbsp; So you could create a dataset with a sequence of &lt;EM&gt;&lt;STRONG&gt;province pairs&lt;/STRONG&gt;&lt;/EM&gt;,&amp;nbsp; i.e. all the 'AB' and 'ON' observations (pair_num=1), then all the 'BC' and 'ON' observations (pair_num=2).&amp;nbsp; Then you could do a sequence of 2x2 tables&amp;nbsp; using PROC FREQ --&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;BY PAIR_NUM&lt;/STRONG&gt;&lt;/EM&gt;, as here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ON;
  set have (where=(province='ON'));
run;

data test ;
  set have (where=(province^='ON'));
  by province ;
  retain pairnum 0   pairing 'XX vs YY';
  if first.province then do;
    pairnum+1;
    pairing=catx(' ',province,'vs','ON');
  end;
  output;

  if last.province then do ptr=1 to n_on;
    set ON nobs=n_on point=ptr;
    output;
  end;
run;

proc freq data=test;
  by pairnum pairing;
  tables province*smm / nopercent nocol ;
  exact relrisk (column=2 method=noscore);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I used the "method=noscore" option because it is much faster than the default (method=score).&amp;nbsp; Take a look at the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/procstat/procstat_freq_syntax03.htm#procstat.freq.freqexrelrisk" target="_self"&gt;RELRISK &amp;lt;(options)&amp;gt;&lt;/A&gt;&amp;nbsp; section of the EXACT statement documentation.&amp;nbsp; If you have a lot of pairings to examine, you might want to test this on just a couple to get an idea of how long it will take to run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And on another note, I don't know how much "confidence" one can have in a set of relrisk confidence limits when each set re-use the same province=ON data.&amp;nbsp; That's an estimation problem that I never had to face.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Aug 2023 01:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-calculating-relative-risk-for-multi-categorical-exposure/m-p/890929#M352022</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-08-25T01:27:02Z</dc:date>
    </item>
  </channel>
</rss>

