<?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: how to do sum group wise analysis and insert after the group by using loops or arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726115#M225632</link>
    <description>&lt;P&gt;Maxim 14. Don't be stupid and try to reinvent the wheel.&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/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;How to do in datastep block&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Mar 2021 12:19:27 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-03-14T12:19:27Z</dc:date>
    <item>
      <title>how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726100#M225625</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="thanikondharish_0-1615718822050.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55913i0FF0419A7E33B16B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="thanikondharish_0-1615718822050.png" alt="thanikondharish_0-1615718822050.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have sashelp.class data set like above dataset and how to do group wise analysis in datastep block?&lt;/P&gt;
&lt;P&gt;first output:&lt;/P&gt;
&lt;P&gt;how to sex wise sum and insert extra record group wise in dataset(we should do data step block only)&lt;/P&gt;
&lt;P&gt;for ref:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="thanikondharish_1-1615719081081.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55914i354A5FFCB9B6764E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="thanikondharish_1-1615719081081.png" alt="thanikondharish_1-1615719081081.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 10:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726100#M225625</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2021-03-14T10:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726101#M225626</link>
      <description>&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;Including such summary data in a data set means that you can't use it for almost any purpose except printing. And Proc Report will do that.&lt;/P&gt;
&lt;P&gt;or Proc Summary and looking at the proper _type_ values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc summary data=sashelp.class;
   class sex name;
   var age height weight;
   types name*sex sex;
   output out=work.summary (drop=_freq_) sum=;
run;

proc sort data=work.summary 
    out=work.want (drop=_type_);
   by sex descending _type_ name;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 11:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726101#M225626</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-14T11:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726106#M225629</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
set sashelp.class;
run;

proc report data=have nowd out=x;
column name sex _sex  age height weight;
define name/display;
define sex/order noprint;
define _sex/computed 'sex';
define age/analysis sum;
define height/analysis sum;
define weight/analysis sum;
compute before sex;
 temp=sex;
endcomp;
compute _sex/character length=20;
 _sex=temp;
endcomp;
compute after sex;
_sex=cats(sex,'-total');
endcomp;
break after sex/summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Mar 2021 11:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726106#M225629</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-14T11:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726107#M225630</link>
      <description>How to do in datastep block&lt;BR /&gt;</description>
      <pubDate>Sun, 14 Mar 2021 11:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726107#M225630</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2021-03-14T11:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726109#M225631</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=have;
by sex;
run;

data want;
length name sex $ 20;
call missing(_age,_height,_weight);
 do until(last.sex);
   set have;
   by sex;
   _age+age;_weight+weight;_height+height;
   output;
 end;
call missing(name,age,weight,height);
sex=cats(sex,'-total');
age=_age;weight=_weight;height=_height;
output;
drop _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Mar 2021 12:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726109#M225631</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-03-14T12:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726115#M225632</link>
      <description>&lt;P&gt;Maxim 14. Don't be stupid and try to reinvent the wheel.&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/209685"&gt;@thanikondharish&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;How to do in datastep block&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Mar 2021 12:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726115#M225632</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-14T12:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to do sum group wise analysis and insert after the group by using loops or arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726178#M225647</link>
      <description>&lt;P&gt;Let SAS sequence your data via the power of &lt;EM&gt;&lt;STRONG&gt;where&lt;/STRONG&gt;&lt;/EM&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (drop=_:);
  set sashelp.class (where=(sex='F'))
      sashelp.class (where=(sex='M'));
  by sex;
  _age+age;
  _height+height;
  _weight+weight;
  output;
  if last.sex;
  age=_age;
  height=_height;
  weight=_weight;
  name='Total';
  output;
  call missing(of _:);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Mar 2021 03:11:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-do-sum-group-wise-analysis-and-insert-after-the-group-by/m-p/726178#M225647</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-15T03:11:11Z</dc:date>
    </item>
  </channel>
</rss>

