<?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 variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389764#M93466</link>
    <description>&lt;P&gt;So you want for &amp;amp;i = 1 that&amp;nbsp;data set resolve to cars?&lt;/P&gt;
&lt;P&gt;You current logic resolves only &amp;amp;I as per you code. You need to&amp;nbsp;apply a &amp;amp; if you want to use a name as a reference to macro variable name, and for resolution: &amp;amp;data1.&lt;/P&gt;
&lt;P&gt;Since this is a two step resolution you need to add additional &amp;amp; so the resolution takes place in the order you need.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Aug 2017 11:06:03 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2017-08-22T11:06:03Z</dc:date>
    <item>
      <title>Resolve macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389761#M93465</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a macro variable :-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let data1= cars;&lt;/P&gt;
&lt;P&gt;%let data2= air;&lt;/P&gt;
&lt;P&gt;%let data3= demo;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and I am using these macro in a do loop:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i %to 3&lt;/P&gt;
&lt;P&gt;proc print data=test1.data&amp;amp;i;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But its not resolving to the desired variable. How to resolve this half macro half string macro variable.&lt;/P&gt;
&lt;P&gt;Please Help.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 11:01:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389761#M93465</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2017-08-22T11:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389764#M93466</link>
      <description>&lt;P&gt;So you want for &amp;amp;i = 1 that&amp;nbsp;data set resolve to cars?&lt;/P&gt;
&lt;P&gt;You current logic resolves only &amp;amp;I as per you code. You need to&amp;nbsp;apply a &amp;amp; if you want to use a name as a reference to macro variable name, and for resolution: &amp;amp;data1.&lt;/P&gt;
&lt;P&gt;Since this is a two step resolution you need to add additional &amp;amp; so the resolution takes place in the order you need.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 11:06:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389764#M93466</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-08-22T11:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389765#M93467</link>
      <description>&lt;P&gt;Could you let me know how to doubly resolve this?&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 11:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389765#M93467</guid>
      <dc:creator>Aditi24</dc:creator>
      <dc:date>2017-08-22T11:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389766#M93468</link>
      <description>&lt;P&gt;For indirect macro variable references, you need to use a double ampersand:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let data1= cars;
%let data2= class;
%let data3= heart;

%macro loop;
%do i = 1 %to 3;

proc print data=sashelp.&amp;amp;&amp;amp;data&amp;amp;i;
run;

%end;
%mend;
%loop&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Use the "little running man" icon to post code, as it will preserve formatting of the code (no additional linefeeds etc when copy/pasting to SAS)&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 11:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389766#M93468</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-22T11:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389773#M93474</link>
      <description>&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n0vl7e3du5f7cjn1g4ajozqxe6b6.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n0vl7e3du5f7cjn1g4ajozqxe6b6.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2017 11:42:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-macro-variable/m-p/389773#M93474</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-08-22T11:42:19Z</dc:date>
    </item>
  </channel>
</rss>

