<?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 Do loop with list of values-get error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543778#M150339</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am trying to create a data set that includes all possible combinations&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get an error &amp;nbsp;"ERROR: Expected %TO not found in %DO statement.&lt;BR /&gt;ERROR: A dummy macro will be compiled."&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_MinDdate=1701;
%let No=24;


%macro myacro3;
%do i=0 %to &amp;amp;No.;
%do j='a','b';
	T_NEHNUT=put(intnx('month',&amp;amp;date_MinDdate.,&amp;amp;i.),yymmn4.)*1;
	x =&amp;amp;j.;
	output;
%end;
%end;
%mend myacro3;

Data ppp;
%myacro3;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 17 Mar 2019 09:40:03 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2019-03-17T09:40:03Z</dc:date>
    <item>
      <title>Do loop with list of values-get error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543778#M150339</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am trying to create a data set that includes all possible combinations&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get an error &amp;nbsp;"ERROR: Expected %TO not found in %DO statement.&lt;BR /&gt;ERROR: A dummy macro will be compiled."&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_MinDdate=1701;
%let No=24;


%macro myacro3;
%do i=0 %to &amp;amp;No.;
%do j='a','b';
	T_NEHNUT=put(intnx('month',&amp;amp;date_MinDdate.,&amp;amp;i.),yymmn4.)*1;
	x =&amp;amp;j.;
	output;
%end;
%end;
%mend myacro3;

Data ppp;
%myacro3;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Mar 2019 09:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543778#M150339</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-03-17T09:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop with list of values-get error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543790#M150345</link>
      <description>&lt;P&gt;First step: change all %do and %end statements. Get rid of the percent signs. DATA steps can execute DO loops, so don't complicate life by using macro code instead of DATA step code.&lt;BR /&gt;&lt;BR /&gt;A likely second step: 1701 is a date in the mid 1960s. Consider ways to convert that to the date you want, so you can feed the right date to INTNX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;********************** EDITED:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Having had time to take a second look, there are additional issues to consider as well.&amp;nbsp; Rather than letting them occur one at a time, here's a better approach that addresses all of them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_MinDdate=1701;
%let No=24;

data ppp;
   do i=0 to &amp;amp;no;
      T_NEHNUT = 1 * put(
      intnx('month', input("20&amp;amp;DateMinDdate.01", yymmdd8.), i), 
      yymmn4.);
      do x='a', 'b';
         output;
      end;
   end;
   drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I hope I balanced the the parentheses properly .... it's untested code.&amp;nbsp; But it should be easy enough to tweak if necessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Mar 2019 13:43:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543790#M150345</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-17T13:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop with list of values-get error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543791#M150346</link>
      <description>If you want combination, use Google or whatever search-site you prefer, there are procedures and functions for such tasks.</description>
      <pubDate>Sun, 17 Mar 2019 12:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543791#M150346</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-17T12:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop with list of values-get error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543814#M150353</link>
      <description>&lt;P&gt;The macro %DO loop does not support all of the functionality of the data step DO loop.&lt;/P&gt;
&lt;P&gt;But since you don't need macro code it doesn't really matter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_MinDdate='01Jan2017'd;
%let No=24;

data ppp;
  do i=0 to &amp;amp;No.;
    do x='a','b';
      T_NEHNUT=input(put(intnx('month',&amp;amp;date_MinDdate.,i),yymmn4.),4.);
      output;
    end;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Mar 2019 16:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-with-list-of-values-get-error/m-p/543814#M150353</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-17T16:20:26Z</dc:date>
    </item>
  </channel>
</rss>

