<?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 Expansion Confusion in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171290#M32879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RW, can you replay the error? which system? as I am not able to see that one coming. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Nov 2014 10:25:06 GMT</pubDate>
    <dc:creator>jakarman</dc:creator>
    <dc:date>2014-11-14T10:25:06Z</dc:date>
    <item>
      <title>Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171286#M32875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can someone please tell me why the second "proc contents" below gives me errors, while the first one is OK?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is shown at the bottom. Thank you!&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;%macro foo(date);&lt;BR /&gt;work.abc_&amp;amp;date.&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%let date=201402;&lt;/P&gt;&lt;P&gt;data abc_&amp;amp;date.;&lt;BR /&gt;run;&lt;BR /&gt;data abc_&amp;amp;date._ext;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%let input=%foo(&amp;amp;date.)_ext;&lt;BR /&gt;proc contents data=&amp;amp;input.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc contents data=%foo(&amp;amp;date.)_ext;&lt;BR /&gt;run;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents data=%foo(&amp;amp;date.)_ext;&lt;BR /&gt;MLOGIC(FOO):&amp;nbsp; Beginning execution.&lt;BR /&gt;SYMBOLGEN:&amp;nbsp; Macro variable DATE resolves to 201402&lt;BR /&gt;MLOGIC(FOO):&amp;nbsp; Parameter DATE has value 201402&lt;BR /&gt;SYMBOLGEN:&amp;nbsp; Macro variable DATE resolves to 201402&lt;BR /&gt;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents data=%foo(&amp;amp;date.)_ext;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, (, CENTILES, DATA, DETAILS, DIR, DIRECTORY, FMTLEN, LIB, MEMTYPE, &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MT, MTYPE, NODETAILS, NODS, NOPRINT, ORDER, OUT, OUT2, SHORT, VARNUM.&lt;/P&gt;&lt;P&gt;39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents data=%foo(&amp;amp;date.)_ext;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 202&lt;BR /&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;MPRINT(FOO):&amp;nbsp; work.abc_201402&lt;BR /&gt;MLOGIC(FOO):&amp;nbsp; Ending execution.&lt;BR /&gt;40&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 23:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171286#M32875</guid>
      <dc:creator>PatRoss</dc:creator>
      <dc:date>2014-11-13T23:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171287#M32876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting. You might have to call TS for this, if nobody here has the answer.&lt;/P&gt;&lt;P&gt;If you get a good answer from TS, please post it here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 08:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171287#M32876</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-11-14T08:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171288#M32877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is working as expected:&lt;/P&gt;&lt;P class="sasSource"&gt; 43&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro foo(date);&lt;/P&gt;&lt;P class="sasSource"&gt; 44&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; work.abc_&amp;amp;date.&lt;/P&gt;&lt;P class="sasSource"&gt; 45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend;&lt;/P&gt;&lt;P class="sasSource"&gt; 46&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents data=%foo(m234019) ;&lt;/P&gt;&lt;P class="sasError" id="sasLogError1_1415957566313"&gt; ERROR: File WORK.ABC_M234019.DATA does not exist.&lt;/P&gt;&lt;P class="sasSource"&gt; 48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P class="sasSource"&gt;&lt;/P&gt;&lt;P class="sasSource"&gt;This also:&lt;/P&gt;&lt;P&gt;43&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro foo(date);&lt;/P&gt;&lt;P class="sasSource"&gt; 44 work.abc_&amp;amp;date.&lt;/P&gt;&lt;P class="sasSource"&gt; 45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend;&lt;/P&gt;&lt;P class="sasSource"&gt; 46&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let date=m234019 ;&lt;/P&gt;&lt;P class="sasSource"&gt; 48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc contents data=%foo(&amp;amp;date) ;&lt;/P&gt;&lt;P class="sasError" id="sasLogError1_1415957647395"&gt; ERROR: File WORK.ABC_M234019.DATA does not exist.&lt;/P&gt;&lt;P class="sasSource"&gt; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P class="sasSource"&gt;&lt;/P&gt;&lt;P class="sasSource"&gt;Trying several other ones and it is giving not any issue (9.4 sas UE).&amp;nbsp; Which version are you using?&lt;/P&gt;&lt;P class="sasSource"&gt;&lt;/P&gt;&lt;P class="sasSource"&gt;I was suspicious on the lifetime of macrovars.&lt;/P&gt;&lt;P class="sasSource"&gt;Declaring date by %let will be a global symbol table. Normal expectation is usage by a macro having a local temporay table.&lt;/P&gt;&lt;P class="sasSource"&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htm#p1b76sxg9dbcyrn1l5age5j5nvgw.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htm#p1b76sxg9dbcyrn1l5age5j5nvgw.htm"&gt;SAS(R) 9.4 Macro Language: Reference, Third Edition&lt;/A&gt; .&lt;/P&gt;&lt;P class="sasSource"&gt;By reading the schema &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htm#p0g7wk5o8cji7ln16v9bmzu5xjto.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htm#p0g7wk5o8cji7ln16v9bmzu5xjto.htm"&gt;SAS(R) 9.4 Macro Language: Reference, Third Edition&lt;/A&gt; there can be an exception.&lt;/P&gt;&lt;P class="sasSource"&gt;As there is no explicit local symbol defined it is not created automically. Referencing a date macro var could go back to the global symbol table. There is global name used by with the same name there. This could causing some logic crack&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 09:36:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171288#M32877</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-11-14T09:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171289#M32878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;(note SAS 9.3) I would guess that its to do with having to do a double pass on the instruction.&amp;nbsp; So in example 1 the pre-processor looks at:&lt;/P&gt;&lt;P&gt;proc contents data=&amp;amp;input.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;And replaces the &amp;amp;input with: work.abc_201402.&amp;nbsp; You will see all other processing is resolved in the %let statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the second example, it would require two passes to get resolution:&lt;/P&gt;&lt;P&gt;proc contents data=%foo(&amp;amp;date.)_ext;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass1 =&lt;/P&gt;&lt;P&gt;proc contents data=work.abc_&amp;amp;date._ext;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass 2 = Would resolve the &amp;amp;date.&lt;/P&gt;&lt;P&gt;However as there is only one pass&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative theory is that there are certain parts of code which cannot resolve macro code at run time.&amp;nbsp; For instance if you put the %foo on a set statement it doesn't resolve until after the set clause, so: set %foo(&amp;amp;date)_ext; also does not work, but putting data %foo(201402); set..; does work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would also be interested in a firm answer.&amp;nbsp; To note there are other ways of getting to what you want:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; date="201402";&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('proc contents data=work.abc_'||strip(date)||'_ext; run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 09:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171289#M32878</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-14T09:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171290#M32879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;RW, can you replay the error? which system? as I am not able to see that one coming. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 10:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171290#M32879</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-11-14T10:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171291#M32880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jaap.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running on SAS 9.3 TS Level 1M2.&amp;nbsp; I get exactly the same issue as the OP and for my test I just put:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set %foo(201402)_ext.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Simliar sort of errors.&amp;nbsp; It seems to be only in certain specific sections, i.e. data= for procedures, set for datasteps. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 10:45:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171291#M32880</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-14T10:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171292#M32881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This time I get a duplicated message, the reason looks to be space somewhere&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not trust the symbol table.&amp;nbsp; Could you try with this?&lt;/P&gt;&lt;P&gt;Aside that space I have no errors ......&amp;nbsp;&amp;nbsp;&amp;nbsp; That space could be that the issue you are saying for procedures&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro foo(date);&lt;/P&gt;&lt;P&gt; %local date ;&lt;BR /&gt;&amp;nbsp; work.abc_&amp;amp;date.&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;44&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro foo(date);&lt;/P&gt;&lt;P class="sasSource"&gt; 46&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; work.abc_&amp;amp;date.&lt;/P&gt;&lt;P class="sasSource"&gt; 47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %mend;&lt;/P&gt;&lt;P class="sasSource"&gt; 48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P class="sasSource"&gt; 49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data want ;&lt;/P&gt;&lt;P class="sasSource"&gt; MLOGIC(FOO):&amp;nbsp; Beginning execution.&lt;/P&gt;&lt;P class="sasSource"&gt; 50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set %foo(201402)_ext ;&lt;/P&gt;&lt;P class="sasSource"&gt; MLOGIC(FOO):&amp;nbsp; Parameter DATE has value 201402&lt;/P&gt;&lt;P class="sasSource"&gt; SYMBOLGEN:&amp;nbsp; Macro variable DATE resolves to 201402&lt;/P&gt;&lt;P class="sasSource"&gt; MPRINT(FOO):&amp;nbsp;&amp;nbsp; work.abc_201402&lt;/P&gt;&lt;P class="sasSource"&gt; MLOGIC(FOO):&amp;nbsp; Ending execution.&lt;/P&gt;&lt;P class="sasError" id="sasLogError1_1415963313242"&gt; ERROR: File WORK.ABC_201402.DATA does not exist.&lt;/P&gt;&lt;P class="sasError" id="sasLogError2_1415963313242"&gt; ERROR: File WORK._EXT.DATA does not exist.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 11:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171292#M32881</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-11-14T11:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171293#M32882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, it doesn't even resolve that one, I just get the ERROR: File work._ext.data does not exist, as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 11:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171293#M32882</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-14T11:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171294#M32883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah I think to understand that.... &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htm#p0eksviivbw6bwn1eg6h2crvl7ct.htm" title="http://support.sas.com/documentation/cdl/en/mcrolref/68140/HTML/default/viewer.htm#p0eksviivbw6bwn1eg6h2crvl7ct.htm"&gt;SAS(R) 9.4 Macro Language: Reference, Third Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The macro is called in the middle of the tokenation process It puts text back and tokenation resumes. as this macro is in the middle of a word in does not get back/restart new tokenation.&amp;nbsp; Yes I see the same happening. The new word is not seen as a new word.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 11:45:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171294#M32883</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-11-14T11:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171295#M32884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a magic, after I put %str() around it. It worked . Maybe these two words are location in different level which make SAS compile it as not what you think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc contents data=&lt;STRONG&gt;%str&lt;/STRONG&gt;(%foo(&amp;amp;date.))_ext;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 12:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171295#M32884</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-14T12:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171296#M32885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, with the %str() you are acutally hiding that part from the compilation check.&amp;nbsp; Do note the warning in the help though if you use that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CAUTION:Do not use %STR to enclose other macro functions or macro invocations that have a list of parameter values. &lt;/P&gt;&lt;P&gt;Because %STR masks parentheses without a match, the macro processor does not recognize the arguments of a function or the parameter values of a macro invocation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 13:02:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171296#M32885</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-14T13:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Expansion Confusion</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171297#M32886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this one also works:&lt;/P&gt;&lt;P class="sasSource"&gt; 47&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data want;&lt;/P&gt;&lt;P class="sasSource"&gt; 48&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set %upcase(%foo(date=201402)_ext) ;&lt;/P&gt;&lt;P class="sasError" id="sasLogError1_1415978307589"&gt; ERROR: File WORK.ABC_201402_EXT.DATA does not exist.&lt;/P&gt;&lt;P class="sasSource"&gt; 49&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P class="sasSource"&gt;&lt;/P&gt;&lt;P class="sasSource"&gt;The behavior does me remember of some JCL Parameter string quirk. The ampersand should be seen outside a string before those in as string would be processed&lt;/P&gt;&lt;P class="sasSource"&gt;The word parser here with sas has also something needed to reset the parse point. let those tech guys come....&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 15:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Expansion-Confusion/m-p/171297#M32886</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-11-14T15:14:03Z</dc:date>
    </item>
  </channel>
</rss>

