<?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 not resolving in loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449643#M113184</link>
    <description>&lt;P&gt;You have too many &amp;amp; in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace the lines you typed with these&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx("a&amp;amp;i",a);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.a&amp;amp;i._01;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hint: debugging these things is much easier if your code begins with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Mar 2018 13:11:09 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-03-29T13:11:09Z</dc:date>
    <item>
      <title>macro not resolving in loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449636#M113180</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;it has to create&amp;nbsp;&lt;/P&gt;&lt;P&gt;sashelp&lt;/P&gt;&lt;P&gt;aa&lt;/P&gt;&lt;P&gt;dd&lt;/P&gt;&lt;P&gt;ss&lt;/P&gt;&lt;P&gt;dd data sets but macro is not resolving.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;S&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards;
input a$;
cards;
sashelp
aa
dd
ss
dd
;
run;

proc sql noprint;
	select count(*) into :numb
	from test;
	;
quit;
%macro a;
%do i=1 %to &amp;amp;numb.;
	data _null_;
	set test (firstobs=&amp;amp;i obs=&amp;amp;i);
	call symput("a&amp;amp;&amp;amp;i",trim(left(a)));
	run;
	data work.&amp;amp;a&amp;amp;i._01;
	  set sashelp.class;
	  run;
	  %end;
%mend;

%a;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 12:56:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449636#M113180</guid>
      <dc:creator>sathya66</dc:creator>
      <dc:date>2018-03-29T12:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: macro not resolving in loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449642#M113183</link>
      <description>&lt;P&gt;This line is wrong:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.&amp;amp;a&amp;amp;i._01;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data work.&amp;amp;&amp;amp;a&amp;amp;i.._01;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This piece won't cause an error, but is mildly misleading:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call symput("a&amp;amp;&amp;amp;i", trim(left(a)));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It should become:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call symputx("a&amp;amp;i", a);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only one ampersand is needed, and switching to SYMPUTX removes all leading and trailing blanks.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 13:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449642#M113183</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-29T13:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: macro not resolving in loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449643#M113184</link>
      <description>&lt;P&gt;You have too many &amp;amp; in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace the lines you typed with these&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call symputx("a&amp;amp;i",a);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.a&amp;amp;i._01;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hint: debugging these things is much easier if your code begins with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Mar 2018 13:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-not-resolving-in-loop/m-p/449643#M113184</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-03-29T13:11:09Z</dc:date>
    </item>
  </channel>
</rss>

