<?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: rookie asks for help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557649#M155503</link>
    <description>&lt;P&gt;Oh well, I don't know how to do that in sql I wish you could post that for me and others to learn&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But datastep dif is easier&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var1-var3;
cards;
2888	362	3018.72
2888	367	13616.76
2888	368	19418.4
2888	369	148.14
2888	378	2250.12
2888	930	3788.4
;
 
data temp;
set have;
if dif(var2) ne 1 then grp+1;
run;

data want;
set temp;
by grp;	
retain newvar '         ';
if first.grp then do; sum=0;newvar=cats(var2);end;
sum+var3;
if last.grp;
if not first.grp then newvar=catx('-',newvar,var2);
drop grp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 09 May 2019 23:39:46 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-05-09T23:39:46Z</dc:date>
    <item>
      <title>Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557651#M155482</link>
      <description>&lt;DIV class="lia-message-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;FITM &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; code &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;5&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;8&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; expend &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;9&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2888 362 3018.72&lt;/P&gt;&lt;P&gt;2888 367 13616.76&lt;/P&gt;&lt;P&gt;2888 368 19418.4&lt;/P&gt;&lt;P&gt;2888 369 148.14&lt;/P&gt;&lt;P&gt;2888 378 2250.12&lt;/P&gt;&lt;P&gt;2888 930 3788.4&lt;/P&gt;&lt;P&gt;2889 362 7264.04&lt;/P&gt;&lt;P&gt;2889 930 2794.49&lt;/P&gt;&lt;P&gt;2898 362 78699.9&lt;/P&gt;&lt;P&gt;2898 367 468766.92&lt;/P&gt;&lt;P&gt;2898 368 738630.6&lt;/P&gt;&lt;P&gt;2898 369 2249.52&lt;/P&gt;&lt;P&gt;2898 378 171642.18&lt;/P&gt;&lt;P&gt;2898 930 24979.8&lt;/P&gt;&lt;P&gt;2899 362 466443.89&lt;/P&gt;&lt;P&gt;2899 367 13273411.86&lt;/P&gt;&lt;P&gt;2899 368 1104602.37&lt;/P&gt;&lt;P&gt;2899 369 15137.85&lt;/P&gt;&lt;P&gt;2899 378 503299.78&lt;/P&gt;&lt;P&gt;2899 930 6100.54&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that the above&amp;nbsp;is table1, how to come up with as table2 with SAS code (letting 367,368,369 in one group and sum up)?&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table2 like&lt;/P&gt;&lt;P&gt;&amp;nbsp; FITM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; expend&lt;/P&gt;&lt;P&gt;2888&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 362&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $$$&lt;/P&gt;&lt;P&gt;2888&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 367-369&amp;nbsp;&amp;nbsp; $$&lt;/P&gt;&lt;P&gt;2888&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 378&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $$$&lt;/P&gt;&lt;P&gt;2888&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 930&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $$$&lt;/P&gt;&lt;P&gt;2889&amp;nbsp;&amp;nbsp;&amp;nbsp; 362....&lt;/P&gt;&lt;P&gt;........&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 00:23:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557651#M155482</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-10T00:23:28Z</dc:date>
    </item>
    <item>
      <title>rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557644#M155500</link>
      <description>&lt;P&gt;&amp;nbsp;Fitm&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Code&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dollar&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;362&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;3018.72&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;367&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;13616.76&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;368&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;19418.4&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;369&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;148.14&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;378&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2250.12&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;930&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;3788.4&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given that this is table1, how to come up with as table2 with SAS code (let 367,368,369) in one group?&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Table2 like&lt;/P&gt;&lt;P&gt;&amp;nbsp; FITM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; code&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dollar&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;362&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;3018.72&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;367-369&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;33183.3&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;378&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2250.12&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2888&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;930&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;3788.4&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 09 May 2019 23:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557644#M155500</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-09T23:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557645#M155501</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/273559"&gt;@pensarchem&lt;/a&gt;&amp;nbsp; &amp;nbsp;So are you grouping anything continuous as one group and summing them? or a mere hardcoded question for knowledge sharing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What i mean is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input var1-var3;
cards;
2888	362	3018.72
2888	367	13616.76
2888	368	19418.4
2888	369	148.14
2888	378	2250.12
2888	930	3788.4
;
 
data w;
set have;
if dif(var2) ne 1 then grp+1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now its just a mere lazy summary&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 23:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557645#M155501</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-09T23:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557648#M155502</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp; Just to clarify, I group them (367,368,369),then sum up.&amp;nbsp;&amp;nbsp; I hope that you can share the knowledge with me.&amp;nbsp; I know how to do it under sql, but I don't know sas. thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I put the header on for each column.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 23:29:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557648#M155502</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-09T23:29:51Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557649#M155503</link>
      <description>&lt;P&gt;Oh well, I don't know how to do that in sql I wish you could post that for me and others to learn&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But datastep dif is easier&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
input var1-var3;
cards;
2888	362	3018.72
2888	367	13616.76
2888	368	19418.4
2888	369	148.14
2888	378	2250.12
2888	930	3788.4
;
 
data temp;
set have;
if dif(var2) ne 1 then grp+1;
run;

data want;
set temp;
by grp;	
retain newvar '         ';
if first.grp then do; sum=0;newvar=cats(var2);end;
sum+var3;
if last.grp;
if not first.grp then newvar=catx('-',newvar,var2);
drop grp;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 May 2019 23:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557649#M155503</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-09T23:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557653#M155484</link>
      <description>&lt;P&gt;Edit your post with self-contained data steps using datalines.&amp;nbsp; Don't make us do your job converting your post into usable code.&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2019 23:57:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557653#M155484</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-09T23:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557655#M155486</link>
      <description>&lt;P&gt;edited the data, thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 00:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557655#M155486</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-10T00:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557656#M155487</link>
      <description>&lt;P&gt;Try again.&amp;nbsp; Cut-and-paste your data into SAS.&amp;nbsp; Does it give the correct results?&amp;nbsp; For me, I get a bunch of missing records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: Wrap your code via "Insert SAS Code".&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 00:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557656#M155487</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-10T00:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557659#M155490</link>
      <description>&lt;P&gt;I'm too impatient.&amp;nbsp; Do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Create a format to collapse data as desired.&lt;/LI&gt;
&lt;LI&gt;Use PROC SUMMARY to collapse your data using formatted input.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Here's some test code.&amp;nbsp; I leave it to you to research PROC SUMMARY and its support of formats to create groups.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   length code 8;
   input code;
   datalines;
362
367
368
369
378
930
362
930
362
367
368
369
378
930
362
367
368
369
378
930
;
run;

proc format;
   value code
      367-369='367-369'
   ;
run;

data want;
   set have;
   group=put(code,code.-L);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 May 2019 01:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557659#M155490</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-10T01:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557662#M155504</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;For a different perspective, I would use PROC MEANS to create an output dataset. The key is a user-defined format that treats the 367, 368, 369 as one group.&lt;/P&gt;
&lt;P&gt;Here's the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines;
input FITM  code  expend ;
datalines;
2888 362 3018.72
2888 367 13616.76
2888 368 19418.4
2888 369 148.14
2888 378 2250.12
2888 930 3788.4
2889 362 7264.04
2889 930 2794.49
2898 362 78699.9
2898 367 468766.92
2898 368 738630.6
2898 369 2249.52
2898 378 171642.18
2898 930 24979.8
2899 362 466443.89
2899 367 13273411.86
2899 368 1104602.37
2899 369 15137.85
2899 378 503299.78
2899 930 6100.54
;
run;

proc format;
  value codef 367-369='367-369';
run;

title 'summarizing with PROC MEANS';
proc means data=have sum nway;
  class FITM code;
  var expend;
  output out=work.meanout sum=expend;
  format code codef.;
run;

proc print data=meanout;
  title 'Using PROC MEANS';
run;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the output dataset work.meanout shown in PROC PRINT:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="proc_print_FITM.png" style="width: 495px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/29396iD13AA466BF553D17/image-size/large?v=v2&amp;amp;px=999" role="button" title="proc_print_FITM.png" alt="proc_print_FITM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course you can drop _TYPE_ and _FREQ_ after you validate the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 01:32:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557662#M155504</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-05-10T01:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557663#M155492</link>
      <description>Hi:&lt;BR /&gt;There's no need to post the same question in 2 different forums. There have been other answers posted here: &lt;A href="https://communities.sas.com/t5/New-SAS-User/rookie-asks-for-help/m-p/557649/highlight/false#M10004" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/rookie-asks-for-help/m-p/557649/highlight/false#M10004&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Fri, 10 May 2019 01:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557663#M155492</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-05-10T01:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Partial group and sum up, need help  thanks.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557664#M155493</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&amp;nbsp;.&amp;nbsp; I'm unsubscribing from this one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 01:34:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557664#M155493</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-10T01:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557861#M155582</link>
      <description>&lt;P&gt;thank you very much!!&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 16:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557861#M155582</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-10T16:24:31Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557863#M155584</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&amp;nbsp; for your reference. thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select&amp;nbsp;fitm,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when&amp;nbsp;code in ('362') then '362'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;when&amp;nbsp;code in ('367','368','369','378') then '367 to 378'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else '930' end ,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum(dollar) as expend&lt;/P&gt;&lt;P&gt;from table1&lt;/P&gt;&lt;P&gt;group by fitm, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case when&amp;nbsp;code in ('362') then '362'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when&amp;nbsp;code in ('367','368','369','378') then '367 to 378'&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else '930' end&lt;/P&gt;&lt;P&gt;order by&amp;nbsp; fitm;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 16:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557863#M155584</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-10T16:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: rookie asks for help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557866#M155586</link>
      <description>&lt;P&gt;Sorry &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;, your program also works very well after tried it just now. I did not understand&amp;nbsp; it yesterday. Thanks again and best wishes.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2019 16:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Partial-group-and-sum-up-need-help-thanks/m-p/557866#M155586</guid>
      <dc:creator>pensarchem</dc:creator>
      <dc:date>2019-05-10T16:40:30Z</dc:date>
    </item>
  </channel>
</rss>

