<?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 Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796913#M255778</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to programming in SAS. I have count data for prescriptions in each year of the study. Each row has the number of prescirpitons in that uear, the person-time, the rate and the ln(person time). I want to use proc genmod to calculate the rate ratio:&lt;/P&gt;&lt;P&gt;1) Between each year of the study compared to the first year of the study (1998) as a reference&lt;/P&gt;&lt;P&gt;2) Between each year of the study and the previous year (i.e. 1999 to 1998, 2000 to 1999 etc)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble to set my estimate statement in the code so I will get the rate ration for each year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my data structure:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Yearrx&lt;/TD&gt;&lt;TD&gt;RX&lt;/TD&gt;&lt;TD&gt;PT&lt;/TD&gt;&lt;TD&gt;rate&lt;/TD&gt;&lt;TD&gt;lnPT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1998&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;135&lt;/TD&gt;&lt;TD&gt;0.740741&lt;/TD&gt;&lt;TD&gt;4.905275&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1999&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;480&lt;/TD&gt;&lt;TD&gt;0.416667&lt;/TD&gt;&lt;TD&gt;6.173786&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;950&lt;/TD&gt;&lt;TD&gt;0.263158&lt;/TD&gt;&lt;TD&gt;6.856462&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2001&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;1100&lt;/TD&gt;&lt;TD&gt;0.272727&lt;/TD&gt;&lt;TD&gt;7.003065&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2002&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;TD&gt;2100&lt;/TD&gt;&lt;TD&gt;0.166667&lt;/TD&gt;&lt;TD&gt;7.649693&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2003&lt;/TD&gt;&lt;TD&gt;450&lt;/TD&gt;&lt;TD&gt;2500&lt;/TD&gt;&lt;TD&gt;0.18&lt;/TD&gt;&lt;TD&gt;7.824046&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoe should my code look like?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;	proc genmod data=h2only  ;
Class Yearrx (ref="1998");
model rx=Yearrx /dist=negbin  scale=deviance offset=ln;
estimate '1998' Yearrx 1 -1;
estimate '1999' Yearrx 1 -1;
estimate '2000' Yearrx 1 -2;
run;y&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Feb 2022 16:19:50 GMT</pubDate>
    <dc:creator>reemm225</dc:creator>
    <dc:date>2022-02-17T16:19:50Z</dc:date>
    <item>
      <title>Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796913#M255778</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to programming in SAS. I have count data for prescriptions in each year of the study. Each row has the number of prescirpitons in that uear, the person-time, the rate and the ln(person time). I want to use proc genmod to calculate the rate ratio:&lt;/P&gt;&lt;P&gt;1) Between each year of the study compared to the first year of the study (1998) as a reference&lt;/P&gt;&lt;P&gt;2) Between each year of the study and the previous year (i.e. 1999 to 1998, 2000 to 1999 etc)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble to set my estimate statement in the code so I will get the rate ration for each year.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my data structure:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Yearrx&lt;/TD&gt;&lt;TD&gt;RX&lt;/TD&gt;&lt;TD&gt;PT&lt;/TD&gt;&lt;TD&gt;rate&lt;/TD&gt;&lt;TD&gt;lnPT&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1998&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;TD&gt;135&lt;/TD&gt;&lt;TD&gt;0.740741&lt;/TD&gt;&lt;TD&gt;4.905275&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1999&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;TD&gt;480&lt;/TD&gt;&lt;TD&gt;0.416667&lt;/TD&gt;&lt;TD&gt;6.173786&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2000&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;950&lt;/TD&gt;&lt;TD&gt;0.263158&lt;/TD&gt;&lt;TD&gt;6.856462&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2001&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;1100&lt;/TD&gt;&lt;TD&gt;0.272727&lt;/TD&gt;&lt;TD&gt;7.003065&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2002&lt;/TD&gt;&lt;TD&gt;350&lt;/TD&gt;&lt;TD&gt;2100&lt;/TD&gt;&lt;TD&gt;0.166667&lt;/TD&gt;&lt;TD&gt;7.649693&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2003&lt;/TD&gt;&lt;TD&gt;450&lt;/TD&gt;&lt;TD&gt;2500&lt;/TD&gt;&lt;TD&gt;0.18&lt;/TD&gt;&lt;TD&gt;7.824046&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoe should my code look like?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;	proc genmod data=h2only  ;
Class Yearrx (ref="1998");
model rx=Yearrx /dist=negbin  scale=deviance offset=ln;
estimate '1998' Yearrx 1 -1;
estimate '1999' Yearrx 1 -1;
estimate '2000' Yearrx 1 -2;
run;y&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 16:19:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796913#M255778</guid>
      <dc:creator>reemm225</dc:creator>
      <dc:date>2022-02-17T16:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796915#M255780</link>
      <description>Is this code more correct?&lt;BR /&gt;&lt;BR /&gt;proc genmod data=h2only ;&lt;BR /&gt;Class Yearrx (ref="1998");&lt;BR /&gt;model rx=Yearrx /dist=negbin scale=deviance offset=ln;&lt;BR /&gt;estimate '1999 vs. 1998' Yearrx 1 -1;&lt;BR /&gt;estimate '2000 vs. 1998' Yearrx 2 -2;&lt;BR /&gt;estimate '2001 vs. 1998' Yearrx 3 -3;&lt;BR /&gt;run;</description>
      <pubDate>Thu, 17 Feb 2022 16:28:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796915#M255780</guid>
      <dc:creator>reemm225</dc:creator>
      <dc:date>2022-02-17T16:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796922#M255784</link>
      <description>&lt;P&gt;Don't use ESTIMATE statement to compare levels. Use the LSMEANS command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;lsmeans yearrx / cl lines linestable;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may not want all of those options, but that is where I would start.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 16:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796922#M255784</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-02-17T16:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rate Ratio of Prescription rates compares to a reference year/or previous year using proc genmod</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796959#M255800</link>
      <description>Thank you! The lsmeans gives a table of Analysis Of Maximum Likelihood Parameter Estimates, where I get the rate ratio for each year compared to 1998- that is what I am looking for...however is there a way to get the estimates (rate ratios) not in logarithmic number but the exponential? I can do it for the rates but not for the parameter estimates. Thank you!</description>
      <pubDate>Thu, 17 Feb 2022 18:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rate-Ratio-of-Prescription-rates-compares-to-a-reference-year-or/m-p/796959#M255800</guid>
      <dc:creator>reemm225</dc:creator>
      <dc:date>2022-02-17T18:35:33Z</dc:date>
    </item>
  </channel>
</rss>

