<?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: Base SAS manipulating calculation using different rows for the numerator and denominator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/449024#M112956</link>
    <description>&lt;P&gt;Thanks Suryakiran.&amp;nbsp; That is a reasonable solution.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Mar 2018 15:40:11 GMT</pubDate>
    <dc:creator>pangea17</dc:creator>
    <dc:date>2018-03-27T15:40:11Z</dc:date>
    <item>
      <title>Base SAS manipulating calculation using different rows for the numerator and denominator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/448837#M112897</link>
      <description>&lt;P&gt;I have a question I am using SAS 9.4 and enterprise guide 7.1. I have a dataset consisting of two months worth of data, summarized.&amp;nbsp; See the enclosed excel workbook with a sample of some of the output.&amp;nbsp; What I am trying to do is use the units and dollars from Nov&amp;nbsp;as the denominator and the units and dollars from December as the numerator. So, I want the row number 11 compared to the row 2 units and dollars units: (38428 / 266324)&amp;nbsp; dollars:(22211515.39 / 160519471.93).&amp;nbsp; So this is basically looking at the number of accounts that moved from a lower bucket to a higher bucket.&amp;nbsp;&amp;nbsp; I would be doing the same calculation for 5 to 30, &amp;nbsp;30 to 60, 60 to 90, 90 to 120, 120 to 150, and 150 to 180. &amp;nbsp;It is&amp;nbsp;also important to use the correct cycle for the comparison, so cycle 1 November vs cycle 1 December.&amp;nbsp; Cycle2 November to Cycle 2 December, cycle 3 to cycle 3 ex cetera.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 00:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/448837#M112897</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2018-03-27T00:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Base SAS manipulating calculation using different rows for the numerator and denominator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/448846#M112902</link>
      <description>&lt;P&gt;You can write a PROC SQL to generate Cartesian&amp;nbsp; product and then filter for your requirements. This is one way of approach, you can also so this kind of approach using a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select t1.*,
		t2.PK as PK_,
		t2.reportingdate	as reportingdate_,
		t2.cycle as cycle_,
		t2.bucket1 as bucket1_,
		t2.units1 as units1_,
		t2.balance1 as balance1_,
		t1.units1/t2.units1 as need1,
		t1.balance1/t2.balance1 as need2
	from have t1,have t2
where t1.cycle=t2.cycle and t1.reportingdate='17DEC2018'D
	and t1.reportingdate&amp;lt;&amp;gt;t2.reportingdate
	and (	( t1.bucket1=5 and t2.bucket1=0) 
		or 	( t1.bucket1=30 and t2.bucket1=5)
		or 	( t1.bucket1=60 and t2.bucket1=30)
		or 	( t1.bucket1=90 and t2.bucket1=60)
		or 	( t1.bucket1=120 and t2.bucket1=90)
		or 	( t1.bucket1=150 and t2.bucket1=120)
		or 	( t1.bucket1=180 and t2.bucket1=150)
		)

order by t1.cycle,t1.reportingdate,t1.bucket1
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Mar 2018 02:20:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/448846#M112902</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-03-27T02:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Base SAS manipulating calculation using different rows for the numerator and denominator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/449024#M112956</link>
      <description>&lt;P&gt;Thanks Suryakiran.&amp;nbsp; That is a reasonable solution.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 15:40:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Base-SAS-manipulating-calculation-using-different-rows-for-the/m-p/449024#M112956</guid>
      <dc:creator>pangea17</dc:creator>
      <dc:date>2018-03-27T15:40:11Z</dc:date>
    </item>
  </channel>
</rss>

