<?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 resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541206#M149388</link>
    <description>&lt;P&gt;The macro&amp;nbsp;&lt;EM&gt;variables&lt;/EM&gt; are local to the macro. Use %global.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And use the proper methods for posting code and logs. "Little running man" for code, {i} for logs. The main posting window scrambles the text.&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2019 20:08:07 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-03-07T20:08:07Z</dc:date>
    <item>
      <title>macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541202#M149386</link>
      <description>&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;I store several lists in a series of macros. However, the macros are not resolved. Anything wrong here? Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ParamData;&lt;BR /&gt;input x @@;&lt;BR /&gt;datalines;&lt;BR /&gt;1 2 3 4 5&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;%macro whatever;&lt;BR /&gt;%do i=1 %to 5;&lt;BR /&gt;proc sql ;&lt;BR /&gt;select x into :ParamList&amp;amp;i separated by ' '&lt;BR /&gt;from ParamData where x&amp;lt;&amp;amp;i+1;&lt;BR /&gt;quit;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%whatever;&lt;/P&gt;&lt;P&gt;%put ParamList = &amp;amp;ParamList1;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 19:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541202#M149386</guid>
      <dc:creator>liyongkai800</dc:creator>
      <dc:date>2019-03-07T19:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541206#M149388</link>
      <description>&lt;P&gt;The macro&amp;nbsp;&lt;EM&gt;variables&lt;/EM&gt; are local to the macro. Use %global.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And use the proper methods for posting code and logs. "Little running man" for code, {i} for logs. The main posting window scrambles the text.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 20:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541206#M149388</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-03-07T20:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: macro not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541207#M149389</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro whatever;
    %do i=1 %to 5;
    %global paramlist&amp;amp;i;
    proc sql ;
         select x into :paramList&amp;amp;i separated by ' '
          from ParamData where x&amp;lt;&amp;amp;i+1;
    quit;
    %end;
%mend;

%whatever&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You need the %global command. Otherwise, macro variables defined inside a macro cannot be used outside the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Furthermore, in the future, please paste your SAS code into the window that appears when you click on the "running man" icon, and then you won't have smiley faces in your SAS code.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2019 20:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-not-resolved/m-p/541207#M149389</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-03-07T20:12:56Z</dc:date>
    </item>
  </channel>
</rss>

