<?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: How to calculate relative risk and confidence interval in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895584#M353848</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have provided sample data , the data was sorted before deriving relative risk and I have provided the major note in the log which says&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;No statistics are computed for drug * event because drug has fewer than 2 nonmissing levels.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample data needs to be provided in the format I have shown, not in the format you used. Even if you sorted the data (which you did not state in your original message), the explanation of that error is stated in my message.&lt;/P&gt;</description>
    <pubDate>Sun, 24 Sep 2023 15:20:23 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-09-24T15:20:23Z</dc:date>
    <item>
      <title>How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895580#M353845</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the following data&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;term&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;event&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;count&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;drug&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Anthralgia&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;yes&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Anthralgia&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;no&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;5&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Nausea&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;yes&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Nausea&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;no&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;5&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Anorexia&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;yes&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;Anorexia&lt;/TD&gt;
&lt;TD width="33.333333333333336%" height="30px"&gt;no&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;5&lt;/TD&gt;
&lt;TD width="16.666666666666668%" height="30px"&gt;A&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Cough&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;yes&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Cough&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;no&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Malaise&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;yes&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="33.333333333333336%"&gt;Malaise&lt;/TD&gt;
&lt;TD width="33.333333333333336%"&gt;no&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;1&lt;/TD&gt;
&lt;TD width="16.666666666666668%"&gt;B&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following code to get relative risk and confidence interval&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;ods output relativerisks=rel;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;proc freq data=test order=data;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; weight count;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tables drug*event / relrisk ;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;by&amp;nbsp; &amp;nbsp;term ;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; run;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;ods output close;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am getting the following message in log and ods output is not being created&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No statistics are computed for&amp;nbsp; DRUG* EVENT because&amp;nbsp; DRUG has fewer than 2 nonmissing levels.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;May I know how to get the code work or any other proc to derive relative risk &amp;amp; CL for above data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Appreciate response!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Sri&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 14:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895580#M353845</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2023-09-24T14:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895582#M353846</link>
      <description>&lt;P&gt;From now on, please present data as working SAS data step code, like this (and not in any other format)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards delimiter='|';
input term :$10.  event :$3.	count drug $;
cards;
Anthralgia|yes|1|A
Anthralgia|no|5|A
Nausea|yes|1|A
Nausea|no|5|A
Anorexia|yes|1|A
Anorexia|no|5|A
Cough|yes|1|B
Cough|no|1|B
Malaise|yes|1|B
Malaise|no|1|B
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;From now on, please present the ENTIRE log, not just one line, and place the log in a code box by clicking on the &amp;lt;/&amp;gt; icon:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 NOTE: ODS statements in the SAS Studio environment may disable some output features.
 69         
 70         data test;
 71         infile cards delimiter='|';
 72         input term :$10.  event :$3.count drug $;
 73         cards;
 
 NOTE: The data set WORK.TEST has 10 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              674.65k
       OS Memory           21412.00k
       Timestamp           09/24/2023 02:58:41 PM
       Step Count                        104  Switch Count  2
       Page Faults                       0
       Page Reclaims                     128
       Page Swaps                        0
       Voluntary Context Switches        13
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 84         ;
 85         
 86         ods output relativerisks=rel;
 87         
 88         proc freq data=test order=data;
 89                 weight count;
 90                 tables drug*event / relrisk ;
 91                by   term ;
 92                 run;
 
 NOTE: No statistics are computed for drug * event because drug has fewer than 2 nonmissing levels.
 NOTE: The above message was for the following BY group:
       term=Anthralgia
&lt;FONT color="#FF0000"&gt; ERROR: Data set WORK.TEST is not sorted in ascending sequence. The current BY group has term = Nausea and the next BY group has 
        term = Anorexia.&lt;/FONT&gt;
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: Output 'relativerisks' was not created.  Make sure that the output object name, label, or path is spelled correctly.  
          Also, verify that the appropriate procedure options are used to produce the requested output object.  For example, verify 
          that the NOPRINT option is not used.
 NOTE: There were 5 observations read from the data set WORK.TEST.
 NOTE: PROCEDURE FREQ used (Total process time):
       real time           0.01 seconds
       user cpu time       0.02 seconds
       system cpu time     0.01 seconds
       memory              2233.78k
       OS Memory           22444.00k
       Timestamp           09/24/2023 02:58:41 PM
       Step Count                        105  Switch Count  4
       Page Faults                       0
       Page Reclaims                     308
       Page Swaps                        0
       Voluntary Context Switches        22
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           536
       
 93         
 94         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 104        &lt;/PRE&gt;
&lt;P&gt;Once we see the ENTIRE log as shown above, it is clear you did not present to us the major ERROR, which is highlighted in red.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By specifying this in the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;       by   term ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the error is obvious now ... SAS can't do this by TERM because the data is not sorted by TERM. In addition, as soon as you limit the analysis to be done BY TERM, there is indeed only a single level DRUG in each value of TERM.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 15:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895582#M353846</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-24T15:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895583#M353847</link>
      <description>&lt;P&gt;I have provided sample data , the data was sorted before deriving relative risk and I have provided the major note in the log which says&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;No statistics are computed for drug * event because drug has fewer than 2 nonmissing levels.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 15:12:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895583#M353847</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2023-09-24T15:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895584#M353848</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have provided sample data , the data was sorted before deriving relative risk and I have provided the major note in the log which says&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;No statistics are computed for drug * event because drug has fewer than 2 nonmissing levels.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sample data needs to be provided in the format I have shown, not in the format you used. Even if you sorted the data (which you did not state in your original message), the explanation of that error is stated in my message.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 15:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895584#M353848</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-24T15:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895585#M353849</link>
      <description>&lt;P&gt;I hope this group to provide a solution rather than commenting on how to present data .I tried to explain sorting error wasn't an issue to not get the code work as sorting was done&amp;nbsp; in real time.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 15:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895585#M353849</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2023-09-24T15:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895587#M353850</link>
      <description>&lt;P&gt;And I explained to you why you are getting the error. I said&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;as soon as you limit the analysis to be done BY TERM, there is indeed only a single level DRUG in each value of TERM.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thus, the error message from SAS is correct, and so no relative risk can be computed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, we're trying to help you, but you need to help us too. From now, please present data in the best possible format for us. Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 15:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895587#M353850</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-24T15:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895647#M353868</link>
      <description>You have to remove "by   term ;" of PROC FREQ.&lt;BR /&gt;Since it is only calculated RELRISK for 2x2 table,&lt;BR /&gt;but for term='Cough' would not form 2x2 table.</description>
      <pubDate>Mon, 25 Sep 2023 11:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895647#M353868</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-25T11:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895703#M353892</link>
      <description>&lt;P&gt;Thanks for your response. I need the output "by term". Any alternative other than proc freq?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 15:57:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895703#M353892</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2023-09-25T15:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895704#M353893</link>
      <description>&lt;P&gt;Sure! Thanks for your response.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 15:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895704#M353893</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2023-09-25T15:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895711#M353897</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/80196"&gt;@sri1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks for your response. I need the output "by term". Any alternative other than proc freq?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;With&lt;FONT face="courier new,courier"&gt; by term;&lt;/FONT&gt; in the code, you cannot compute relative risk, that is what SAS is telling you. There is only one level of&amp;nbsp; DRUG when you limit the analysis with the BY statement. In this case, relative risk is not mathematically defined, and so I doubt any PROC in SAS can do this.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2023 16:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895711#M353897</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-09-25T16:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895870#M353949</link>
      <description>You gotta know &lt;BR /&gt;for 2x2 table :&lt;BR /&gt;&lt;BR /&gt;a1 a2&lt;BR /&gt;b1 b2&lt;BR /&gt;&lt;BR /&gt;for the first column&lt;BR /&gt;RELRISK= (a1/(a1+a2)) / (b1/(b1+b2));&lt;BR /&gt;&lt;BR /&gt;for the second column&lt;BR /&gt;RELRISK= (a2/(a1+a2)) / (b2/(b1+b2)) ;  &lt;BR /&gt;&lt;BR /&gt;if you don't have b1 and b2 (a.k.a b1=0,b2=0), how could you get RELRISK?&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Sep 2023 11:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/895870#M353949</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-26T11:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/896523#M354242</link>
      <description>&lt;P&gt;Thanks for your response.For the above data as relrisk can't be computed , can you please let me know how can I define in a macro not to run above procedure as there is no enough data&amp;nbsp; and don't get warning in log that "Output 'relativerisks' was not created" and end the macro.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 19:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/896523#M354242</guid>
      <dc:creator>sri1</dc:creator>
      <dc:date>2023-09-29T19:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to calculate relative risk and confidence interval</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/896542#M354252</link>
      <description>&lt;PRE&gt;data test;
infile cards delimiter='|';
input term :$10.  event :$3.	count drug $;
cards;
Anthralgia|yes|1|A
Anthralgia|no|5|A
Nausea|yes|1|A
Nausea|no|5|A
Anorexia|yes|1|A
Anorexia|no|5|A
Cough|yes|1|B
Cough|no|1|B
Malaise|yes|1|A
Malaise|no|1|A
;


%macro relrisk(dsn=);
proc sql;
create table want as
select * from &amp;amp;dsn 
 group by term
  having count(distinct catx(' ',event,drug))=4 and sum(count=0)=0 ;
quit;

%let dsid=%sysfunc(open(want));
%let nlobs=%sysfunc(attrn(&amp;amp;dsid,nlobs));
%let dsid=%sysfunc(close(&amp;amp;dsid.));
%if &amp;amp;nlobs. %then %do;
  ods output relativerisks=rel;
proc freq data=want order=data;
        weight count;
        tables drug*event / relrisk ;
       by   term ;
        run;
%end;
%mend;

%relrisk(dsn=test)
&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Sep 2023 04:08:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-calculate-relative-risk-and-confidence-interval/m-p/896542#M354252</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-09-30T04:08:45Z</dc:date>
    </item>
  </channel>
</rss>

