<?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: using an iterative do loop for a macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724941#M225098</link>
    <description>Thank you! Yes, that worked!</description>
    <pubDate>Tue, 09 Mar 2021 18:39:58 GMT</pubDate>
    <dc:creator>Emma_at_SAS</dc:creator>
    <dc:date>2021-03-09T18:39:58Z</dc:date>
    <item>
      <title>using an iterative do loop for a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724648#M224986</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a macro for serveyfreq that I would like to repeat for 4 levels of &amp;amp;var_name. Therefore I added&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i=&lt;STRONG&gt;1&lt;/STRONG&gt; %to i=&lt;STRONG&gt;4&lt;/STRONG&gt;; ....end (vane_name is a numerical variable); The macro runs well without the do loop but not with the do loop. I appreciate your suggestions to resolve this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* without do loop;&lt;/P&gt;
&lt;P&gt;%macro posthoc(var_name);&lt;/P&gt;
&lt;P&gt;proc surveyfreq data = data_have VARHEADER = NAMELABEL nosummary; &lt;BR /&gt;tables gender/ testp=(50 50) nostd row row(cl) cv chisq; &lt;BR /&gt;where &amp;amp;var_name = &lt;STRONG&gt;1&lt;/STRONG&gt; and condition=1;&lt;BR /&gt;weight weight_resc;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;mend posthoc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* with do loop;&lt;/P&gt;
&lt;P&gt;%macro posthoc(var_name);&lt;/P&gt;
&lt;P&gt;%do i=1 %to i=4;&lt;/P&gt;
&lt;P&gt;proc surveyfreq data = data_have VARHEADER = NAMELABEL nosummary; &lt;BR /&gt;tables gender/ testp=(50 50) nostd row row(cl) cv chisq; &lt;BR /&gt;where &amp;amp;var_name = &lt;STRONG&gt;1&lt;/STRONG&gt; and condition=1;&lt;BR /&gt;weight weight_resc;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;end;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;mend posthoc;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 20:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724648#M224986</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-03-08T20:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: using an iterative do loop for a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724652#M224988</link>
      <description>Why not just use a BY statement instead?&lt;BR /&gt;&lt;BR /&gt;proc surveyfreq data = data_have VARHEADER = NAMELABEL nosummary;&lt;BR /&gt;by var_name;&lt;BR /&gt;tables gender/ testp=(50 50) nostd row row(cl) cv chisq;&lt;BR /&gt;where  condition=1;&lt;BR /&gt;weight weight_resc;&lt;BR /&gt;run;&lt;BR /&gt;quit;</description>
      <pubDate>Mon, 08 Mar 2021 20:52:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724652#M224988</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-08T20:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: using an iterative do loop for a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724686#M225002</link>
      <description>&lt;P&gt;Thanks, Reeza. That was a good idea! I wanted to use two loops for both var_name and condition. Now, I need only one do loop. Would you please help me to figure this out?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 22:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724686#M225002</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-03-08T22:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: using an iterative do loop for a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724693#M225005</link>
      <description>&lt;P&gt;Or add two variables to your BY statement instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc surveyfreq data = data_have VARHEADER = NAMELABEL nosummary;
by var_name condition;
tables gender/ testp=(50 50) nostd row row(cl) cv chisq;
where condition=1;
weight weight_resc;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/84351"&gt;@Emma_at_SAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks, Reeza. That was a good idea! I wanted to use two loops for both var_name and condition. Now, I need only one do loop. Would you please help me to figure this out?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 23:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724693#M225005</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-08T23:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: using an iterative do loop for a macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724941#M225098</link>
      <description>Thank you! Yes, that worked!</description>
      <pubDate>Tue, 09 Mar 2021 18:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-an-iterative-do-loop-for-a-macro/m-p/724941#M225098</guid>
      <dc:creator>Emma_at_SAS</dc:creator>
      <dc:date>2021-03-09T18:39:58Z</dc:date>
    </item>
  </channel>
</rss>

