<?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: Macro : Repeative Case statement into a Do Loop in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285672#M19549</link>
    <description>&lt;P&gt;Use a data step and array - a single data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macros will just make this complicated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2016 23:33:18 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-07-19T23:33:18Z</dc:date>
    <item>
      <title>Macro : Repeative Case statement into a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285659#M19547</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to make a macro with one variable where one can define quantile (e.g. flag data with appropriate mark - for example: in case it belongs to the lowest decile as Q10, etc.). The script does not store all values of i, it goes from 1 to the defined number N but then only stores the last result (i.e. N), any suggestions how to keep all values of i and thus gain all cases?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; M(N);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%DO&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; i=&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%TO&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;N.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;/P&gt;&lt;P&gt;CREATE TABLE G AS&lt;/P&gt;&lt;P&gt;SELECT VAR1,&lt;/P&gt;&lt;P&gt;VAR2,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;CASE WHEN&amp;nbsp;VAR2 &amp;lt;= (&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-(&amp;amp;i-&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;)/&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;) * MAX(VAR2) AND VAR2&amp;gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;-&amp;amp;i/&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;) * MAX(VAR2) THEN &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;"Q&amp;amp;i"&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; END AS FLAG&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;FROM B;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%END&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%MEND&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; M;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;%&lt;STRONG&gt;&lt;I&gt;M&lt;/I&gt;&lt;/STRONG&gt;(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;10&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jiri&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 06:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285659#M19547</guid>
      <dc:creator>Uknown_user</dc:creator>
      <dc:date>2016-07-21T06:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Macro : Repeative Case statement into a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285662#M19548</link>
      <description>&lt;P&gt;Many ideas, but just one suggestion to start. &amp;nbsp;Get the program to work by hard-coding everything, without using macro language. &amp;nbsp;Once it is working, we can look at converting it into a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you do that, you will have to debug both SAS language errors and macro language errors at the same time ... a much more difficult task.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 22:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285662#M19548</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-07-19T22:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro : Repeative Case statement into a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285672#M19549</link>
      <description>&lt;P&gt;Use a data step and array - a single data step.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macros will just make this complicated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 23:33:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285672#M19549</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-19T23:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Macro : Repeative Case statement into a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285673#M19550</link>
      <description>&lt;P&gt;And proc rank wouldn't work either?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want indicators for deciles you'll need to transpose the final table but again it's fully dynamic without macros.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 23:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285673#M19550</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-19T23:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Macro : Repeative Case statement into a Do Loop</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285767#M19562</link>
      <description>&lt;P&gt;It appears like I will indeed have to do that. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 07:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Macro-Repeative-Case-statement-into-a-Do-Loop/m-p/285767#M19562</guid>
      <dc:creator>Uknown_user</dc:creator>
      <dc:date>2016-07-20T07:06:57Z</dc:date>
    </item>
  </channel>
</rss>

