<?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 Help with Do loop for proc Expand in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141811#M296689</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find the Highest value within a give window, I use the proc expand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to find the Highest value for a number of window say from 3 to 5. I can run the proc 3 times as below.&lt;/P&gt;&lt;P&gt;However, I would like to make it kind of "do from START to END" so it will provide more flexibility and make the code better controlled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me with that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HHC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input var1 var2;&lt;BR /&gt;datalines;&lt;BR /&gt;3 2&lt;BR /&gt;4 2&lt;BR /&gt;0 5&lt;BR /&gt;8 9&lt;BR /&gt;6 11&lt;BR /&gt;100 20&lt;BR /&gt;20 60&lt;BR /&gt;40 25&lt;BR /&gt;10 6&lt;BR /&gt;50 29&lt;BR /&gt;100 20&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc expand data=have out=want;&lt;BR /&gt;convert var1=max_3/transformout=(MOVmax&amp;nbsp; 3); &lt;BR /&gt;convert var1=max_4/transformout=(MOVmax&amp;nbsp; 4); &lt;BR /&gt;convert var1=max_5/transformout=(MOVmax&amp;nbsp; 5);&lt;BR /&gt;run; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jun 2014 14:32:37 GMT</pubDate>
    <dc:creator>hhchenfx</dc:creator>
    <dc:date>2014-06-13T14:32:37Z</dc:date>
    <item>
      <title>Help with Do loop for proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141811#M296689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To find the Highest value within a give window, I use the proc expand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to find the Highest value for a number of window say from 3 to 5. I can run the proc 3 times as below.&lt;/P&gt;&lt;P&gt;However, I would like to make it kind of "do from START to END" so it will provide more flexibility and make the code better controlled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please help me with that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HHC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;input var1 var2;&lt;BR /&gt;datalines;&lt;BR /&gt;3 2&lt;BR /&gt;4 2&lt;BR /&gt;0 5&lt;BR /&gt;8 9&lt;BR /&gt;6 11&lt;BR /&gt;100 20&lt;BR /&gt;20 60&lt;BR /&gt;40 25&lt;BR /&gt;10 6&lt;BR /&gt;50 29&lt;BR /&gt;100 20&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc expand data=have out=want;&lt;BR /&gt;convert var1=max_3/transformout=(MOVmax&amp;nbsp; 3); &lt;BR /&gt;convert var1=max_4/transformout=(MOVmax&amp;nbsp; 4); &lt;BR /&gt;convert var1=max_5/transformout=(MOVmax&amp;nbsp; 5);&lt;BR /&gt;run; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 14:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141811#M296689</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2014-06-13T14:32:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Do loop for proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141812#M296690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not make a macro .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro m(start=,end=)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc expand data=have out=want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%do i=&amp;amp;start %to &amp;amp;end ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;convert var1=max_&amp;amp;i /transformout=(MOVmax&amp;nbsp; &amp;amp;i ); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend m;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%m(start=3,end=5)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Xia Keshan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 14:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141812#M296690</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-06-13T14:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Do loop for proc Expand</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141813#M296691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Xia.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HHC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 20:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Do-loop-for-proc-Expand/m-p/141813#M296691</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2014-06-13T20:14:53Z</dc:date>
    </item>
  </channel>
</rss>

