<?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 summing up data into months in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208322#M38725</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data input;&lt;/P&gt;&lt;P&gt;input desc $2. tran_date date9. cnt 3. amt 3.;&lt;/P&gt;&lt;P&gt;format tran_date date9.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;A 13Feb2015 2 10&lt;/P&gt;&lt;P&gt;A 10Jan2015 1 10&lt;/P&gt;&lt;P&gt;A 09Jan2015 1 20&lt;/P&gt;&lt;P&gt;B 05Feb2014 2 10&lt;/P&gt;&lt;P&gt;B 05Dec2014 2 20&lt;/P&gt;&lt;P&gt;B 02Dec2014 1 20&lt;/P&gt;&lt;P&gt;C 20Feb2015 1 10&lt;/P&gt;&lt;P&gt;C 31Jan2015 2 10&lt;/P&gt;&lt;P&gt;C 10Dec2014 2 20&lt;/P&gt;&lt;P&gt;C 10Dec2014 1 20&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the desired output is as follows -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="9710" alt="sas.png" class="jive-image-thumbnail jive-image" height="121" src="https://communities.sas.com/legacyfs/online/9710_sas.png" width="508" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The month sums that I need to take is from 201308 to current month which results in a big query, if I try to do it with sql.&lt;/P&gt;&lt;P&gt;Can I do it datastep and macros ?&lt;/P&gt;&lt;P&gt;I would like to have an option to drop Dec2014_Cnt and take only the Dec2014_Amt alon with 4 other fields. Kindly advice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Mar 2015 22:36:25 GMT</pubDate>
    <dc:creator>rajat051984</dc:creator>
    <dc:date>2015-03-23T22:36:25Z</dc:date>
    <item>
      <title>summing up data into months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208322#M38725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data input;&lt;/P&gt;&lt;P&gt;input desc $2. tran_date date9. cnt 3. amt 3.;&lt;/P&gt;&lt;P&gt;format tran_date date9.;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;A 13Feb2015 2 10&lt;/P&gt;&lt;P&gt;A 10Jan2015 1 10&lt;/P&gt;&lt;P&gt;A 09Jan2015 1 20&lt;/P&gt;&lt;P&gt;B 05Feb2014 2 10&lt;/P&gt;&lt;P&gt;B 05Dec2014 2 20&lt;/P&gt;&lt;P&gt;B 02Dec2014 1 20&lt;/P&gt;&lt;P&gt;C 20Feb2015 1 10&lt;/P&gt;&lt;P&gt;C 31Jan2015 2 10&lt;/P&gt;&lt;P&gt;C 10Dec2014 2 20&lt;/P&gt;&lt;P&gt;C 10Dec2014 1 20&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the desired output is as follows -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="9710" alt="sas.png" class="jive-image-thumbnail jive-image" height="121" src="https://communities.sas.com/legacyfs/online/9710_sas.png" width="508" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The month sums that I need to take is from 201308 to current month which results in a big query, if I try to do it with sql.&lt;/P&gt;&lt;P&gt;Can I do it datastep and macros ?&lt;/P&gt;&lt;P&gt;I would like to have an option to drop Dec2014_Cnt and take only the Dec2014_Amt alon with 4 other fields. Kindly advice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208322#M38725</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T22:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: summing up data into months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208323#M38726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you actually need a data set or a report in this layout?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208323#M38726</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-23T22:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: summing up data into months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208324#M38727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I got your question wrong earlier. I need a report. The key field is not Desc but 6 other fields. But the count, amount layout is the one I mentioned. As you can figure it ,the report length will increase by two columns every month, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: rajat panda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 22:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208324#M38727</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T22:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: summing up data into months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208325#M38728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't store data in this format but you report it using proc report in this format -- or proc tabulate. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you absolutely do need to store it this way then calculate the sums using proc means and then proc transpose the dataset. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 23:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208325#M38728</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-23T23:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: summing up data into months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208326#M38729</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data inpt (drop=tran_date);&lt;BR /&gt; set input;&lt;BR /&gt; new_var=put(intnx('month',tran_date,0),monname3.)||put(year(tran_date),4.);&lt;BR /&gt;run;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=inpt ; by desc new_var ; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc tabulate data=inpt ;&lt;/P&gt;&lt;P&gt; class desc new_var;&lt;/P&gt;&lt;P&gt; var cnt amt;&lt;/P&gt;&lt;P&gt; tables desc='',new_var='' *(cnt amt)*sum=''/Box=Desc;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 11:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208326#M38729</guid>
      <dc:creator>Vish33</dc:creator>
      <dc:date>2015-03-24T11:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: summing up data into months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208327#M38730</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank&amp;nbsp; you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 12:40:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/summing-up-data-into-months/m-p/208327#M38730</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-24T12:40:17Z</dc:date>
    </item>
  </channel>
</rss>

