<?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: Resolve macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252045#M47736</link>
    <description>&lt;P&gt;Could you provide the corresponding piece of log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a feeling that this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;string!!i&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;won't work as you expect, as it will try to concatenate the contents of STRING with the contents of I (instead of giving you the contents of string1 or string2 or string3 and so on)&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2016 14:21:02 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-02-24T14:21:02Z</dc:date>
    <item>
      <title>Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252019#M47728</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;have macros string1, string2, string3 declared and initialized in code and I want to send the control to a labeled section which will put them in a message box. However, the do loop in the message box is unable to retrieve the value of macro variable by using the statement:-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;commandlist=insertc(commandlist,string!!i,i);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;here is the main part of the code:-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let string1;&lt;BR /&gt;%let string2;&lt;BR /&gt;%let string3;
%let n; 
    if anyspace(selpath)                                                                                                                                                                                                                                        
         then do;  
			string1="Path Should Not Contain Blank Spaces";&lt;BR /&gt;                        string2="select another path";
			n=1;
            link errormsg;                                                                                                                                                                                                                   
            tmp_lstbtn._cursor();                                                                                                                                                                                                                               
            return;                                                                                                                                                                                                                                             
         end;

	errormsg:
	commandlist=makelist();
	do i=1 to n;
	commandlist=insertc(commandlist,string!!i,i);
	end;
	command=messagebox(commandlist,'S','O',"ERROR: Header Generator");
	commandlist=dellist(commandlist);
	return;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Please suggest a method to get the string values iteratively so that it could be inserted int he list.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 12:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252019#M47728</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-02-24T12:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252025#M47729</link>
      <description>&lt;P&gt;With the exception of the 4 %let commands, this is all data step code. I guess you're confusing data step code with macro code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;string1 ist not equal to &amp;amp;string1 !!!!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 12:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252025#M47729</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-24T12:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252029#M47730</link>
      <description>&lt;P&gt;Can I suggest you post some test data, and what you want the output to look like. &amp;nbsp;You may also want to clarify what software you are using, as this doesn't look like Base SAS, this is a function call:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;         tmp_lstbtn&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;_cursor&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;       &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 13:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252029#M47730</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-24T13:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252041#M47734</link>
      <description>&lt;P&gt;Note: This is a snippet from&amp;nbsp;SAS Component Language.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 14:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252041#M47734</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2016-02-24T14:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252043#M47735</link>
      <description>&lt;P&gt;Ah, so your using AF/SCL. &amp;nbsp;Unfortunately I am not able to help here then, I haven't used it in many years. &amp;nbsp;Am surprised its still being used to be honest. &amp;nbsp;You will probably find that there are currently better methods nowadays if you want to do app deverlopment. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 14:15:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252043#M47735</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-24T14:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252045#M47736</link>
      <description>&lt;P&gt;Could you provide the corresponding piece of log?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a feeling that this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;string!!i&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;won't work as you expect, as it will try to concatenate the contents of STRING with the contents of I (instead of giving you the contents of string1 or string2 or string3 and so on)&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 14:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252045#M47736</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-24T14:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252053#M47739</link>
      <description>&lt;P&gt;Yes, I think you have hit the nail on the head there KurtBremser. &amp;nbsp;The INSERTC command takes this form:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="emph"&gt;rc&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN class="strong"&gt;INSERTC&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;list-id&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;cval&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;,&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;index&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;,&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&amp;gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what is appears he is trying to do is use the iterator i to indicate if the value should be string1 or string2. &amp;nbsp;As I said its been a long time since I used this, so am fixed on arrays, or macro. &amp;nbsp;However the question I would say is why have string1/2/3 etc. as macro variables in the first place. &amp;nbsp;Why not insert these into a list of thier own:&lt;/P&gt;
&lt;PRE&gt;   if anyspace(selpath) then do;
      stringlist=makelist();
      stringlist=insertc(stringlist,"Path Should Not Contain Blank Spaces",1);
      stringlist=insertc(stringlist,"select another path",2);
      link errormsg;                                                                                                                                                                                                                   
      tmp_lstbtn._cursor();                                                                                                                                                                                                                               
      return;                                                                                                                                                                                                                                             
   end;
&lt;/PRE&gt;
&lt;P&gt;SCL lists are the method for handling lists of values, so use them rather than creating macro variables?&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-size: 13.44px; line-height: 16.8px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 14:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variables/m-p/252053#M47739</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-24T14:33:11Z</dc:date>
    </item>
  </channel>
</rss>

