<?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 Calculations with multiple observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240499#M44378</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have data like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;D &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;E&lt;/P&gt;
&lt;P&gt;20141231 193.83 &amp;nbsp;93.04 &amp;nbsp;129.98 &amp;nbsp;96.15&lt;BR /&gt;20150102 194.41 &amp;nbsp;93.02 &amp;nbsp;129.95 &amp;nbsp;95.03&lt;BR /&gt;20150105 188.34 &amp;nbsp;90.56 &amp;nbsp;129.05 &amp;nbsp;93.5&lt;BR /&gt;20150106 184.53 &amp;nbsp;88.63 &amp;nbsp;127.53 &amp;nbsp;92.95&lt;BR /&gt;20150107 187.28 &amp;nbsp;90.3 &amp;nbsp; &amp;nbsp;129.51 &amp;nbsp;94.87&lt;BR /&gt;20150108 190.27 &amp;nbsp;91.58 &amp;nbsp;131.8 &amp;nbsp; 97.06&lt;BR /&gt;20150109 187.35 &amp;nbsp;90.42 &amp;nbsp;131.54 &amp;nbsp;95.99&lt;BR /&gt;20150112 185.07 &amp;nbsp;89.5 &amp;nbsp; &amp;nbsp;30.87 &amp;nbsp; &amp;nbsp;95.86&lt;BR /&gt;20150113 184.93 &amp;nbsp;89.23 &amp;nbsp;131.17 &amp;nbsp;95.01&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to calcute Score = B1*B2+C1*C2+D1*D2+E1*E2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to perform this calculation in SAS, Please advise&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2015 17:35:48 GMT</pubDate>
    <dc:creator>Coa_SAs</dc:creator>
    <dc:date>2015-12-22T17:35:48Z</dc:date>
    <item>
      <title>Calculations with multiple observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240499#M44378</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have data like below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;D &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;E&lt;/P&gt;
&lt;P&gt;20141231 193.83 &amp;nbsp;93.04 &amp;nbsp;129.98 &amp;nbsp;96.15&lt;BR /&gt;20150102 194.41 &amp;nbsp;93.02 &amp;nbsp;129.95 &amp;nbsp;95.03&lt;BR /&gt;20150105 188.34 &amp;nbsp;90.56 &amp;nbsp;129.05 &amp;nbsp;93.5&lt;BR /&gt;20150106 184.53 &amp;nbsp;88.63 &amp;nbsp;127.53 &amp;nbsp;92.95&lt;BR /&gt;20150107 187.28 &amp;nbsp;90.3 &amp;nbsp; &amp;nbsp;129.51 &amp;nbsp;94.87&lt;BR /&gt;20150108 190.27 &amp;nbsp;91.58 &amp;nbsp;131.8 &amp;nbsp; 97.06&lt;BR /&gt;20150109 187.35 &amp;nbsp;90.42 &amp;nbsp;131.54 &amp;nbsp;95.99&lt;BR /&gt;20150112 185.07 &amp;nbsp;89.5 &amp;nbsp; &amp;nbsp;30.87 &amp;nbsp; &amp;nbsp;95.86&lt;BR /&gt;20150113 184.93 &amp;nbsp;89.23 &amp;nbsp;131.17 &amp;nbsp;95.01&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to calcute Score = B1*B2+C1*C2+D1*D2+E1*E2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to perform this calculation in SAS, Please advise&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 17:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240499#M44378</guid>
      <dc:creator>Coa_SAs</dc:creator>
      <dc:date>2015-12-22T17:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations with multiple observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240501#M44379</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Your formula is correct and will work directly in SAS, by adding a semi colon.

What issue are you having?

Score = B1*B2+C1*C2+D1*D2+E1*E2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Dec 2015 17:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240501#M44379</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-22T17:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations with multiple observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240505#M44382</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to multiply first obervation with second and second with third and thrid with fourth.etc.and summing all the reult.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2015 18:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240505#M44382</guid>
      <dc:creator>Coa_SAs</dc:creator>
      <dc:date>2015-12-22T18:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations with multiple observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240507#M44383</link>
      <description>Post the expected output from the data above. Are you looking forward or looking back - does it matter? Looking back is easier, you can use the lag function.&lt;BR /&gt;&lt;BR /&gt;score=B*lag1(b)+c*lag(c) + d1*lag(d) +e*lag1(e);</description>
      <pubDate>Tue, 22 Dec 2015 18:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240507#M44383</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-12-22T18:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations with multiple observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240585#M44407</link>
      <description>&lt;P&gt;Try to get the next record adjacent to the current record and then use the formula.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Date          B1            C1        D1          E1;
cards;
20141231 193.83  93.04  129.98  96.15
20150102 194.41  93.02  129.95  95.03
20150105 188.34  90.56  129.05  93.5
20150106 184.53  88.63  127.53  92.95
20150107 187.28  90.3    129.51  94.87
20150108 190.27  91.58  131.8   97.06
20150109 187.35  90.42  131.54  95.99
20150112 185.07  89.5    30.87    95.86
20150113 184.93  89.23  131.17  95.01
;

data want;
obss=_n_+1;
set have end=last; if obss&amp;lt;=nobs then set have(keep=b1 c1 d1 e1 rename=(b1=b2 c1=c2 d1=d2 e1=e2)) end=last nobs=nobs point=obss;
if not last then score=sum(B1*B2,C1*C2,D1*D2,E1*E2);
else do;
score=.;
call missing(b2,c2,d2,e2) ;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 02:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240585#M44407</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2015-12-23T02:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculations with multiple observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240674#M44441</link>
      <description>&lt;P&gt;Thanks Reeza and Jagadishkatam, Its working now. Hooray!&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 16:27:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculations-with-multiple-observations/m-p/240674#M44441</guid>
      <dc:creator>Coa_SAs</dc:creator>
      <dc:date>2015-12-23T16:27:45Z</dc:date>
    </item>
  </channel>
</rss>

