<?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 quaterly report in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/quaterly-report/m-p/59391#M12860</link>
    <description>The layout of the report is:&lt;BR /&gt;
Last_name first_name city state zip bsm 2009_1Qtotal 2009_1Qshare 2009_2Qtotal 2009_2Q share ...2008_1Qtotal 2008_1Qshare&lt;BR /&gt;
&lt;BR /&gt;
I.e rolling quarters from current month(quater) to 2008 1Q.&lt;BR /&gt;
&lt;BR /&gt;
I use proc sql to come up with each quater total and share.&lt;BR /&gt;
&lt;BR /&gt;
share is    sum of "mydrug"mg/sum of total mg.&lt;BR /&gt;
&lt;BR /&gt;
I'm wondering if there is anyway out to circumvent my long proc sql statements.&lt;BR /&gt;
&lt;BR /&gt;
As a sample please see my code :&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 create table toppres as&lt;BR /&gt;
  select phy_name,City ,state,ZIP,ghtm,&lt;BR /&gt;
  sum(case &lt;BR /&gt;
when ship_date &amp;gt;= intnx ('qtr',"&amp;amp;sysdate"D,-1) and ship_date &amp;lt;  intnx ('month',intnx('qtr',"&amp;amp;sysdate"d,-1),3) then mg_dispensed end) as Q1total,&lt;BR /&gt;
&lt;BR /&gt;
sum(case &lt;BR /&gt;
when ship_date &amp;gt;= intnx ('qtr',"&amp;amp;sysdate"D,-1) and &lt;BR /&gt;
ship_date &amp;lt;  intnx ('month',intnx('qtr',"&amp;amp;sysdate"d,-1),3) and drug='NORDITROPIN' then mg_dispensed end) as Q1nordi &lt;BR /&gt;
from allphysicians_gsm&lt;BR /&gt;
group by phy_name,City ,state, drug,ghtm,ZIP&lt;BR /&gt;
order by q1total desc;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
so the 1Q share is q1nordi/q1total.</description>
    <pubDate>Tue, 28 Jul 2009 17:50:48 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2009-07-28T17:50:48Z</dc:date>
    <item>
      <title>quaterly report</title>
      <link>https://communities.sas.com/t5/SAS-Programming/quaterly-report/m-p/59391#M12860</link>
      <description>The layout of the report is:&lt;BR /&gt;
Last_name first_name city state zip bsm 2009_1Qtotal 2009_1Qshare 2009_2Qtotal 2009_2Q share ...2008_1Qtotal 2008_1Qshare&lt;BR /&gt;
&lt;BR /&gt;
I.e rolling quarters from current month(quater) to 2008 1Q.&lt;BR /&gt;
&lt;BR /&gt;
I use proc sql to come up with each quater total and share.&lt;BR /&gt;
&lt;BR /&gt;
share is    sum of "mydrug"mg/sum of total mg.&lt;BR /&gt;
&lt;BR /&gt;
I'm wondering if there is anyway out to circumvent my long proc sql statements.&lt;BR /&gt;
&lt;BR /&gt;
As a sample please see my code :&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 create table toppres as&lt;BR /&gt;
  select phy_name,City ,state,ZIP,ghtm,&lt;BR /&gt;
  sum(case &lt;BR /&gt;
when ship_date &amp;gt;= intnx ('qtr',"&amp;amp;sysdate"D,-1) and ship_date &amp;lt;  intnx ('month',intnx('qtr',"&amp;amp;sysdate"d,-1),3) then mg_dispensed end) as Q1total,&lt;BR /&gt;
&lt;BR /&gt;
sum(case &lt;BR /&gt;
when ship_date &amp;gt;= intnx ('qtr',"&amp;amp;sysdate"D,-1) and &lt;BR /&gt;
ship_date &amp;lt;  intnx ('month',intnx('qtr',"&amp;amp;sysdate"d,-1),3) and drug='NORDITROPIN' then mg_dispensed end) as Q1nordi &lt;BR /&gt;
from allphysicians_gsm&lt;BR /&gt;
group by phy_name,City ,state, drug,ghtm,ZIP&lt;BR /&gt;
order by q1total desc;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
so the 1Q share is q1nordi/q1total.</description>
      <pubDate>Tue, 28 Jul 2009 17:50:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/quaterly-report/m-p/59391#M12860</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2009-07-28T17:50:48Z</dc:date>
    </item>
  </channel>
</rss>

