<?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: Question on arithmetic conversion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314014#M68336</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data summ1;
set dataset (rename=(
  amount=oldamount
  avg1=oldavg1
  avg2=oldavg2
));
by objname;
if first.objname
then do;
  amount = 0;
  avg1 = 0;
  avg2 = 0;
end;
amount + oldamount;
avg1 + oldavg1;
avg2 + oldavg2;
if last.objname
then do;
  avg1 = avg1 / amount;
  avg2 = avg2 / amount;
  output;
end;
drop oldamount oldavg1 oldavg2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"Manual" solution.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Nov 2016 09:11:37 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-11-24T09:11:37Z</dc:date>
    <item>
      <title>Question on arithmetic conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/313999#M68328</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am pretty new to SAS but I hve to maintain some older programs. Now I am stuck with a problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a program that does this:&lt;/P&gt;&lt;P&gt;PROC MEANS NOPRINT;&lt;BR /&gt;VAR AMOUNT AVG1 AVG2;&lt;BR /&gt;BY OBJNAME;&lt;BR /&gt;OUTPUT OUT=WORK.SUMM1&lt;BR /&gt;SUM(AMOUNT) = AMOUNT&lt;BR /&gt;MEAN(AVG1 AVG2) =&lt;BR /&gt;AVG1 AVG2 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sadly the input data of AVG1 and AVG2 is not an average at all but the cumulated data, so to get real averages at the end I would have to do sum up AVG1 and AVG2 for each OBJNAME and divide it by AMOUNT.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I do&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PROC MEANS NOPRINT; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VAR AMOUNT AVG1 AVG2; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BY OBJNAME; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OUTPUT OUT=WORK.SUMM1 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SUM(AMOUNT) = AMOUNT &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SUM(AVG1 AVG2) = &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;AVG1 AVG2 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;it looks nice but I still need the division, my idea was putting in something like&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;AVG1= AVG1/AMOUNT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but I didn't find a way how this could work.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Maybe someone van give me a hint how to do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 08:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/313999#M68328</guid>
      <dc:creator>wetzer123</dc:creator>
      <dc:date>2016-11-24T08:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Question on arithmetic conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314014#M68336</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data summ1;
set dataset (rename=(
  amount=oldamount
  avg1=oldavg1
  avg2=oldavg2
));
by objname;
if first.objname
then do;
  amount = 0;
  avg1 = 0;
  avg2 = 0;
end;
amount + oldamount;
avg1 + oldavg1;
avg2 + oldavg2;
if last.objname
then do;
  avg1 = avg1 / amount;
  avg2 = avg2 / amount;
  output;
end;
drop oldamount oldavg1 oldavg2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;"Manual" solution.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 09:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314014#M68336</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-24T09:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Question on arithmetic conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314032#M68344</link>
      <description>&lt;P&gt;I will have to check this, as I am not shure wether it will no confuse with my data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 09:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314032#M68344</guid>
      <dc:creator>wetzer123</dc:creator>
      <dc:date>2016-11-24T09:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Question on arithmetic conversion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314033#M68345</link>
      <description>&lt;P&gt;Unless you make use of the auomatically created _type_ and _freq_ variables, you should get the right output.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 09:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-arithmetic-conversion/m-p/314033#M68345</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-24T09:53:27Z</dc:date>
    </item>
  </channel>
</rss>

