<?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: ADDING/MERGING ROWS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242684#M45061</link>
    <description>&lt;P&gt;Or using my favorite proc:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data=have nway noprint;
class ID;
id age;
var salary;
output out=want (drop=_:) sum=;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The id statement copies the age variable to the output dataset (assuming that it is constant within the variable ID).&lt;/P&gt;
&lt;P&gt;The nway option hides the total row (all IDs).&lt;/P&gt;
&lt;P&gt;The drop= dataset option drops the automatic variables _FREQ_ and _TYPE_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Eric&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jan 2016 12:39:50 GMT</pubDate>
    <dc:creator>EH</dc:creator>
    <dc:date>2016-01-11T12:39:50Z</dc:date>
    <item>
      <title>ADDING/MERGING ROWS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242571#M45038</link>
      <description>Id age salary&lt;BR /&gt;1 23 3000&lt;BR /&gt;2 34 5000&lt;BR /&gt;4 26 2000&lt;BR /&gt;4 26 2000&lt;BR /&gt;5 32 4000&lt;BR /&gt;5 32 5000&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;Id age salary&lt;BR /&gt;1 23 3000&lt;BR /&gt;2 34 5000&lt;BR /&gt;4 26 4000&lt;BR /&gt;5 32 9000&lt;BR /&gt;&lt;BR /&gt;How can we achieve this output. Plz help</description>
      <pubDate>Sat, 09 Jan 2016 19:39:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242571#M45038</guid>
      <dc:creator>Manish_Choubey</dc:creator>
      <dc:date>2016-01-09T19:39:27Z</dc:date>
    </item>
    <item>
      <title>Re: ADDING/MERGING ROWS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242573#M45040</link>
      <description>&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input id age salary;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1 23 3000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2 34 5000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4 26 2000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4 26 2000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5 32 4000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5 32 5000&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select id,age,sum(salary) as salary&lt;/P&gt;
&lt;P&gt;from have&lt;/P&gt;
&lt;P&gt;group by id,age;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 20:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242573#M45040</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-01-09T20:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: ADDING/MERGING ROWS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242684#M45061</link>
      <description>&lt;P&gt;Or using my favorite proc:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc means data=have nway noprint;
class ID;
id age;
var salary;
output out=want (drop=_:) sum=;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The id statement copies the age variable to the output dataset (assuming that it is constant within the variable ID).&lt;/P&gt;
&lt;P&gt;The nway option hides the total row (all IDs).&lt;/P&gt;
&lt;P&gt;The drop= dataset option drops the automatic variables _FREQ_ and _TYPE_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 12:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ADDING-MERGING-ROWS/m-p/242684#M45061</guid>
      <dc:creator>EH</dc:creator>
      <dc:date>2016-01-11T12:39:50Z</dc:date>
    </item>
  </channel>
</rss>

