<?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 how to use data step to calculate summary group by multiple sub groups? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34671#M8491</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 26 Oct 2011 03:41:54 GMT</pubDate>
    <dc:creator>julie2</dc:creator>
    <dc:date>2011-10-26T03:41:54Z</dc:date>
    <item>
      <title>how to use data step to calculate summary group by multiple sub groups?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34669#M8489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I replace following PROC SQL code using data step code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;select division, category, sum(salary) as total_salary from tbl_salary&lt;/P&gt;&lt;P&gt;group by division, category;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 02:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34669#M8489</guid>
      <dc:creator>julie2</dc:creator>
      <dc:date>2011-10-26T02:57:11Z</dc:date>
    </item>
    <item>
      <title>how to use data step to calculate summary group by multiple sub groups?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34670#M8490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Julia,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It takes a lot less code with proc sql but, since you asked, I think that the following will do the same thing.&amp;nbsp; I added an extra field, namely employee_id (emp_id) to indicate that you would have to drop any additional fields if you want the output to be the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=tbl_salary;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by division category;&lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data divsalary; &lt;/P&gt;&lt;P&gt;&amp;nbsp; set tbl_salary (drop=em_id); &lt;/P&gt;&lt;P&gt;&amp;nbsp; by division category;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.category then total_salary =0; &lt;/P&gt;&lt;P&gt;&amp;nbsp; total_salary+salary; &lt;/P&gt;&lt;P&gt;&amp;nbsp; if last.category then output; &lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=divsalary;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;:&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 03:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34670#M8490</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-26T03:12:28Z</dc:date>
    </item>
    <item>
      <title>how to use data step to calculate summary group by multiple sub groups?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34671#M8491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Much appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Julia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Oct 2011 03:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/how-to-use-data-step-to-calculate-summary-group-by-multiple-sub/m-p/34671#M8491</guid>
      <dc:creator>julie2</dc:creator>
      <dc:date>2011-10-26T03:41:54Z</dc:date>
    </item>
  </channel>
</rss>

