<?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: Reduce datasteps in count and sum in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267589#M52901</link>
    <description>&lt;P&gt;HI freelanceReinhard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run your code there seems to be a problem with case_ID is doesn't count properly.&lt;/P&gt;&lt;P&gt;Is it possible to rewrite it as a macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12504i91597705C3705316/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="case_id.JPG" title="case_id.JPG" /&gt;</description>
    <pubDate>Mon, 02 May 2016 13:15:20 GMT</pubDate>
    <dc:creator>piddy</dc:creator>
    <dc:date>2016-05-02T13:15:20Z</dc:date>
    <item>
      <title>Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267559#M52894</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you can help me. This is the output from the code below and I was hoping there is a smart way to reduce the datasteps. There&lt;/P&gt;&lt;P&gt;are other variable in the original dataset but the variables below are the ones&amp;nbsp;important for the coding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OBJECT_ID Case_ID Case_count Case_count_sum&lt;/P&gt;&lt;P&gt;10104PROD21C4CE&amp;nbsp;1&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10104PROD21C4CE&amp;nbsp;1&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10201PROD230948&amp;nbsp;2&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10201PROD230948&amp;nbsp;2&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10207PROD2315A8&amp;nbsp;3&amp;nbsp;1&amp;nbsp;3&lt;BR /&gt;10207PROD2315A8&amp;nbsp;3&amp;nbsp;2&amp;nbsp;3&lt;BR /&gt;10207PROD2315A8&amp;nbsp;3&amp;nbsp;3&amp;nbsp;3&lt;BR /&gt;10280PROD23FEB7&amp;nbsp;4&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10280PROD23FEB7&amp;nbsp;4&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10294PROD242336&amp;nbsp;5&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10294PROD242336&amp;nbsp;5&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10300PROD242B33&amp;nbsp;6&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10300PROD242B33&amp;nbsp;6&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10300PROD242CE7&amp;nbsp;7&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10300PROD242CE7&amp;nbsp;7&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10302PROD243380&amp;nbsp;8&amp;nbsp;1&amp;nbsp;3&lt;BR /&gt;10302PROD243380&amp;nbsp;8&amp;nbsp;2&amp;nbsp;3&lt;BR /&gt;10302PROD243380&amp;nbsp;8&amp;nbsp;3&amp;nbsp;3&lt;BR /&gt;10347PROD2495CD&amp;nbsp;9&amp;nbsp;1&amp;nbsp;1&lt;BR /&gt;10347PROD2495E8&amp;nbsp;10&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10347PROD2495E8&amp;nbsp;10&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;10349PROD249971&amp;nbsp;11&amp;nbsp;1&amp;nbsp;1&lt;BR /&gt;10356PROD24A468&amp;nbsp;12&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;10356PROD24A468&amp;nbsp;12&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;11005PROD24DB55&amp;nbsp;13&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;11005PROD24DB55&amp;nbsp;13&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;11006PROD24DEA6&amp;nbsp;14&amp;nbsp;1&amp;nbsp;3&lt;BR /&gt;11006PROD24DEA6&amp;nbsp;14&amp;nbsp;2&amp;nbsp;3&lt;BR /&gt;11006PROD24DEA6&amp;nbsp;14&amp;nbsp;3&amp;nbsp;3&lt;BR /&gt;11012PROD24ED64&amp;nbsp;15&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;11012PROD24ED64&amp;nbsp;15&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;11013PROD24F0D4&amp;nbsp;16&amp;nbsp;1&amp;nbsp;1&lt;BR /&gt;11013PROD24F0DA&amp;nbsp;17&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;11013PROD24F0DA&amp;nbsp;17&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;11017PROD24F6D6&amp;nbsp;18&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;11017PROD24F6D6&amp;nbsp;18&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;11024PROD250F13&amp;nbsp;19&amp;nbsp;1&amp;nbsp;1&lt;BR /&gt;11027PROD251616&amp;nbsp;20&amp;nbsp;1&amp;nbsp;2&lt;BR /&gt;11027PROD251616&amp;nbsp;20&amp;nbsp;2&amp;nbsp;2&lt;BR /&gt;11028PROD2518E3&amp;nbsp;21&amp;nbsp;1&amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; testm;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt; X&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; OBJECT_ID;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;retain&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; OBJECT_ID;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; first.OBJECT_ID &lt;/FONT&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_ID+&lt;/FONT&gt;&lt;FONT color="#800080" size="2"&gt;&lt;FONT color="#800080" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; testm2; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; testm; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT size="2"&gt;Case_count+&lt;/FONT&gt;&lt;FONT color="#800080" size="2"&gt;&lt;FONT color="#800080" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; first.Case_ID &lt;/FONT&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_count=&lt;/FONT&gt;&lt;FONT color="#800080" size="2"&gt;&lt;FONT color="#800080" size="2"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;sort&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;data&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;=testm2; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_ID &lt;/FONT&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;descending&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_count; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; testm3;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;set&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; testm2; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;by&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_ID; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;retain&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_count_sum; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; first.Case_ID &lt;/FONT&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;then&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; Case_count_sum=Case_count; &lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;output&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;FONT color="#0000e6" size="2"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 11:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267559#M52894</guid>
      <dc:creator>piddy</dc:creator>
      <dc:date>2016-05-02T11:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267570#M52896</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83456"&gt;@piddy﻿&lt;/a&gt;, welcome to the forum,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, your code could be simplified. For a specific suggestion it would be good to know how your final dataset should look like. Is the goal exactly the "output" you've posted? Or are, for example, Case_ID and Case_count&amp;nbsp;only means to the end of creating Case_count_sum and you don't actually need them?&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 12:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267570#M52896</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-02T12:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267573#M52897</link>
      <description>&lt;P&gt;Here is a solution using the so called &lt;A href="http://www2.sas.com/proceedings/sugi28/099-28.pdf" target="_blank"&gt;DOW loop technique&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
do until(last.object_id);
  set x;
  by object_id;
  Case_count_sum=sum(case_count_sum,1);
end;
do until(last.object_id);
  set x;
  by object_id;
  Case_ID+first.object_id;
  Case_count=sum(case_count,1);
  output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you don't need Case_ID or Case_count, you can simply delete the respective line in the code where these are calculated.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 12:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267573#M52897</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-02T12:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267589#M52901</link>
      <description>&lt;P&gt;HI freelanceReinhard&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run your code there seems to be a problem with case_ID is doesn't count properly.&lt;/P&gt;&lt;P&gt;Is it possible to rewrite it as a macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12504i91597705C3705316/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="case_id.JPG" title="case_id.JPG" /&gt;</description>
      <pubDate>Mon, 02 May 2016 13:15:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267589#M52901</guid>
      <dc:creator>piddy</dc:creator>
      <dc:date>2016-05-02T13:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267602#M52902</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83456"&gt;@piddy﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot replicate your issue. When I run my code with the following test data, I obtain the result shown further below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
input OBJECT_ID $15.;
cards;
10104PROD21C4CE
10104PROD21C4CE
10201PROD230948
10201PROD230948
10207PROD2315A8
10207PROD2315A8
10207PROD2315A8
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/2985i1E36C82E258CD624/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="want.png" title="want.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still encounter issues, please post suitable test data in the form of a data step (as I did above) and the program code (unless&amp;nbsp;you left my code unchanged).&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 13:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267602#M52902</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-02T13:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267606#M52903</link>
      <description>&lt;P&gt;Hi again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution was correct. Thank you so much again.&amp;nbsp;I&amp;nbsp;made&amp;nbsp;a mistake in dropping some variabels. I'm not so good at macros yet but how could I rewrite your code to a macro?&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 13:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267606#M52903</guid>
      <dc:creator>piddy</dc:creator>
      <dc:date>2016-05-02T13:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: Reduce datasteps in count and sum</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267608#M52904</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83456"&gt;@piddy&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I'm not so good at macros yet but how could I rewrite your code to a macro?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First, you should clarify if you really need a macro.&amp;nbsp;I've seen all too many posts in this forum with (failed) attempts to use macro language where other techniques (mostly data and proc steps) would have been more appropriate. Maybe your case justifies writing a macro. If so, you have to decide which parts of the existing data step code are to be made flexible by using macro parameters.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 14:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reduce-datasteps-in-count-and-sum/m-p/267608#M52904</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-05-02T14:05:34Z</dc:date>
    </item>
  </channel>
</rss>

