<?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: AUTOMATION FOR SUM FUNCTION in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752203#M236917</link>
    <description>&lt;P&gt;Do the sum by day before you transpose the table.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Jul 2021 04:35:52 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-07-06T04:35:52Z</dc:date>
    <item>
      <title>AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752170#M236899</link>
      <description>&lt;P&gt;Hey there community!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I wanted to know if it is possible to automate a SUM function to iterate, for example:&lt;/P&gt;&lt;P&gt;I have this:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PROC SQL; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;CREATE TABLE&lt;/FONT&gt; combined3 AS &lt;FONT color="#0000FF"&gt;SELECT &lt;/FONT&gt;PAYROLL, NAME, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V01JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V01JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V02JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V02JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V03JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V03JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V04JUN2021)&lt;FONT color="#0000FF"&gt; AS&lt;/FONT&gt; _V04JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V05JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V05JUN2021, (...) ,&lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V30JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt;&amp;nbsp;_V30JUN2021&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But every month the headers&amp;nbsp;_V01&lt;FONT color="#FF0000"&gt;&lt;U&gt;JUN&lt;/U&gt;&lt;/FONT&gt;2021 will change for&amp;nbsp;_V01&lt;FONT color="#FF0000"&gt;&lt;U&gt;JUL&lt;/U&gt;&lt;/FONT&gt;2021, so I would have to change every month all the code above, is there any way to automate this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you all in advanced!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 22:52:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752170#M236899</guid>
      <dc:creator>KatiaBravo</dc:creator>
      <dc:date>2021-07-05T22:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752171#M236900</link>
      <description>&lt;P&gt;If you use PROC MEANS it does most of this automatically. &lt;BR /&gt;Do you have to use SQL?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=have noprint nway;
class payroll name;
var _V: ;
output out=want sum= ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here is a reference that illustrates how to refer to variables and datasets in a short cut list:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/388000"&gt;@KatiaBravo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hey there community!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wanted to know if it is possible to automate a SUM function to iterate, for example:&lt;/P&gt;
&lt;P&gt;I have this:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PROC SQL; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;CREATE TABLE&lt;/FONT&gt; combined3 AS &lt;FONT color="#0000FF"&gt;SELECT &lt;/FONT&gt;PAYROLL, NAME, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V01JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V01JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V02JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V02JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V03JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V03JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V04JUN2021)&lt;FONT color="#0000FF"&gt; AS&lt;/FONT&gt; _V04JUN2021, &lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V05JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt; _V05JUN2021, (...) ,&lt;FONT color="#0000FF"&gt;SUM&lt;/FONT&gt;(_V30JUN2021) &lt;FONT color="#0000FF"&gt;AS&lt;/FONT&gt;&amp;nbsp;_V30JUN2021&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But every month the headers&amp;nbsp;_V01&lt;FONT color="#FF0000"&gt;&lt;U&gt;JUN&lt;/U&gt;&lt;/FONT&gt;2021 will change for&amp;nbsp;_V01&lt;FONT color="#FF0000"&gt;&lt;U&gt;JUL&lt;/U&gt;&lt;/FONT&gt;2021, so I would have to change every month all the code above, is there any way to automate this?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you all in advanced!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jul 2021 23:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752171#M236900</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-05T23:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752203#M236917</link>
      <description>&lt;P&gt;Do the sum by day before you transpose the table.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 04:35:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752203#M236917</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-06T04:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752207#M236921</link>
      <description>&lt;P&gt;I would like to emphasis what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt; already recommended:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Do the sum by day before you transpose the table.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It would skip transposing the data at all, because as soon as you have data in variable-names, all subsequent steps will become more difficult to write. In the worst-case you end up using tons of macro-variables making the code as readable as cuneiform script.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 05:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752207#M236921</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-07-06T05:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752361#M236977</link>
      <description>&lt;P&gt;Thanks a ton!!!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to do SQL because I thought I needed to do a loop or a DO, but this worked just fine!!!!&lt;/P&gt;&lt;P&gt;Thanks for real!! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jul 2021 17:24:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752361#M236977</guid>
      <dc:creator>KatiaBravo</dc:creator>
      <dc:date>2021-07-06T17:24:48Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752363#M236978</link>
      <description>Thaaaanks again Chris!!! I always get so confused for real!! &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;Will take all of your advice! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;</description>
      <pubDate>Tue, 06 Jul 2021 17:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752363#M236978</guid>
      <dc:creator>KatiaBravo</dc:creator>
      <dc:date>2021-07-06T17:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: AUTOMATION FOR SUM FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752364#M236979</link>
      <description>Thanks for your advice, will keep this in mind to enhance my code! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;</description>
      <pubDate>Tue, 06 Jul 2021 17:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/AUTOMATION-FOR-SUM-FUNCTION/m-p/752364#M236979</guid>
      <dc:creator>KatiaBravo</dc:creator>
      <dc:date>2021-07-06T17:27:44Z</dc:date>
    </item>
  </channel>
</rss>

