<?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: ERROR: The macro variable name is either all blank or missing. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498034#M132222</link>
    <description>Thanks a lot for your reply.&lt;BR /&gt;&lt;BR /&gt;1. I am sure that there will always be some records meet that criteria. Because if change to vis_s, the error will disappear and get the expected result. Also, if I put a default value for vis with %let before select, I am afraid the macro value will always the default value.&lt;BR /&gt;&lt;BR /&gt;2. Sorry, it a typo. But even if it’s vis everywhere, still same error will occur.&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select avisitn into: vis separated by "-"&lt;BR /&gt;from avisit&lt;BR /&gt;where paramcd="&amp;amp;paramcd." %if %upcase(&amp;amp;paramcd)=PNIF or %upcase(&amp;amp;paramcd)=EQ5D0206 or %upcase(&amp;amp;paramcd)=SEV %then %do; and avisitn&amp;lt;=8 %end;&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;vis;&lt;BR /&gt;&lt;BR /&gt;%include mac_a(ancova_wocf_mi.sas);&lt;BR /&gt;&lt;BR /&gt;%do jj=1 %to %sysfunc(countw(&amp;amp;vis,%str(-)));&lt;BR /&gt;%let visn=%scan(&amp;amp;vis,&amp;amp;jj, -);&lt;BR /&gt;%put &amp;amp;visn;&lt;BR /&gt;%ancova_wocf_mi(data=&amp;amp;data., paramcd=&amp;amp;paramcd., chgorpchg=&amp;amp;chgorpchg., avisitn=&amp;amp;visn., censornum=&amp;amp;censornum., popoth=&amp;amp;popoth.);&lt;BR /&gt;%end;&lt;BR /&gt;</description>
    <pubDate>Sat, 22 Sep 2018 03:31:31 GMT</pubDate>
    <dc:creator>Juanjuan</dc:creator>
    <dc:date>2018-09-22T03:31:31Z</dc:date>
    <item>
      <title>ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498020#M132212</link>
      <description>&lt;P&gt;The log will show error message when i submitted the code below. But the error will be gone if the macro variable name was changed. What's the reason for this error? the macro used to execute well, but will met this error every day, and i have to change the macro names every time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. the first time &amp;amp;vis&lt;/P&gt;&lt;P&gt;2. then i will change it to &amp;amp;vis_t.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; proc sql noprint;
    select  avisitn into: vis separated by "-"
        from avisit
            where paramcd="&amp;amp;paramcd." %if %upcase(&amp;amp;paramcd)=PNIF or   %upcase(&amp;amp;paramcd)=EQ5D0206 or  %upcase(&amp;amp;paramcd)=SEV %then %do; and avisitn&amp;lt;=8 %end;
    ;
quit;

%put &amp;amp;vis;

%include mac_a(ancova_wocf_mi.sas);

    %do jj=1 %to %sysfunc(countw(&amp;amp;vis_s,%str(-)));
        %let visn=%scan(&amp;amp;vis,&amp;amp;jj, -);
        %put &amp;amp;visn;
		%ancova_wocf_mi(data=&amp;amp;data., paramcd=&amp;amp;paramcd., chgorpchg=&amp;amp;chgorpchg., avisitn=&amp;amp;visn., censornum=&amp;amp;censornum., popoth=&amp;amp;popoth.);
		%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 22 Sep 2018 01:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498020#M132212</guid>
      <dc:creator>Juanjuan</dc:creator>
      <dc:date>2018-09-22T01:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498030#M132219</link>
      <description>&lt;P&gt;I don't see the error message. Which macro variable is it complaining about?&lt;/P&gt;
&lt;P&gt;I don't think SAS would generate an error message like that. Perhaps the macro you are calling is generating the error?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 02:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498030#M132219</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-22T02:57:35Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498031#M132220</link>
      <description>&lt;P&gt;A few observations just from looking at the posted code.&lt;/P&gt;
&lt;P&gt;1) The SELECT statement will not create VIS if no records meet that criteria.&amp;nbsp; You should add a %LET before the SELECT to set some default value. This will insure the VIS is created.&lt;/P&gt;
&lt;P&gt;2) At the top you look to be creating VIS then next you are starting a %DO loop with upper bound based on the number of words in a different macro variable named VIS_S. Then later you are using %SCAN() to pull words from VIS again.&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 03:01:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498031#M132220</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-22T03:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498034#M132222</link>
      <description>Thanks a lot for your reply.&lt;BR /&gt;&lt;BR /&gt;1. I am sure that there will always be some records meet that criteria. Because if change to vis_s, the error will disappear and get the expected result. Also, if I put a default value for vis with %let before select, I am afraid the macro value will always the default value.&lt;BR /&gt;&lt;BR /&gt;2. Sorry, it a typo. But even if it’s vis everywhere, still same error will occur.&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;select avisitn into: vis separated by "-"&lt;BR /&gt;from avisit&lt;BR /&gt;where paramcd="&amp;amp;paramcd." %if %upcase(&amp;amp;paramcd)=PNIF or %upcase(&amp;amp;paramcd)=EQ5D0206 or %upcase(&amp;amp;paramcd)=SEV %then %do; and avisitn&amp;lt;=8 %end;&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%put &amp;amp;vis;&lt;BR /&gt;&lt;BR /&gt;%include mac_a(ancova_wocf_mi.sas);&lt;BR /&gt;&lt;BR /&gt;%do jj=1 %to %sysfunc(countw(&amp;amp;vis,%str(-)));&lt;BR /&gt;%let visn=%scan(&amp;amp;vis,&amp;amp;jj, -);&lt;BR /&gt;%put &amp;amp;visn;&lt;BR /&gt;%ancova_wocf_mi(data=&amp;amp;data., paramcd=&amp;amp;paramcd., chgorpchg=&amp;amp;chgorpchg., avisitn=&amp;amp;visn., censornum=&amp;amp;censornum., popoth=&amp;amp;popoth.);&lt;BR /&gt;%end;&lt;BR /&gt;</description>
      <pubDate>Sat, 22 Sep 2018 03:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498034#M132222</guid>
      <dc:creator>Juanjuan</dc:creator>
      <dc:date>2018-09-22T03:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498036#M132224</link>
      <description>Post the error from the code using MPRINT and SYMBOLGEN.</description>
      <pubDate>Sat, 22 Sep 2018 03:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498036#M132224</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-22T03:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498037#M132225</link>
      <description>Thanks for your reply.&lt;BR /&gt;&lt;BR /&gt;I really don’t know what’s happened. I just added the codes below and tested again with VIS and VIS_S. Both marco variable names seems fine now with no errors. But I am still worried the error will show again next time.&lt;BR /&gt;&lt;BR /&gt;options mprint symbolgen;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 22 Sep 2018 04:04:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498037#M132225</guid>
      <dc:creator>Juanjuan</dc:creator>
      <dc:date>2018-09-22T04:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498633#M132561</link>
      <description>&lt;P&gt;Hello,&amp;nbsp; today the pgm was run in another computer and shows error again, but after rerun the second time, the error disappeared. And the macro name is&amp;nbsp; not resolved from %do statement.&amp;nbsp; Actually, the VIS_S was already resolved to 6-7-8-9-10.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; %do jj=1 %to %sysfunc(countw(&amp;amp;vis_s,%str(-)));
        %let visn=%scan(&amp;amp;vis_s,&amp;amp;jj, -);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select  avisitn into: vis_s separated by "-"
        from avisit
            where paramcd="&amp;amp;paramcd." %if %upcase(&amp;amp;paramcd)=PNIF or   %upcase(&amp;amp;paramcd)=EQ5D0206 or  %upcase(&amp;amp;paramcd)=SEV %then %do; and avisitn&amp;lt;=8 %end;
    ;
quit;

%put &amp;amp;vis_s;

%include mac_a(ancova_wocf_mi.sas);

    %do jj=1 %to %sysfunc(countw(&amp;amp;vis_s,%str(-)));
        %let visn=%scan(&amp;amp;vis_s,&amp;amp;jj, -);
        %put &amp;amp;visn;
		%ancova_wocf_mi(data=&amp;amp;data., paramcd=&amp;amp;paramcd., chgorpchg=&amp;amp;chgorpchg., avisitn=&amp;amp;visn., censornum=&amp;amp;censornum., popoth=&amp;amp;popoth.);
		%end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_all.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23501i189DC610E3C30DD8/image-size/large?v=v2&amp;amp;px=999" role="button" title="_all.PNG" alt="_all.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 03:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498633#M132561</guid>
      <dc:creator>Juanjuan</dc:creator>
      <dc:date>2018-09-25T03:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498634#M132562</link>
      <description>&lt;P&gt;This type of error is usually a small type or a misunderstanding with what's happening and resolving when, ie using CALL EXECUTE and not realizing they don't run until after the data step is complete.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unfortunately the only way to diagnose this error is to examine all the code and you would have to provide that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have nested macros so the issue could be embedded somewhere. I would set MPRINT and SYMBOLGEN and test&amp;nbsp;it until it errors out. The error with that information should give you a pretty good idea of where to look, or which variables to check.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182408"&gt;@Juanjuan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp; today the pgm was run in another computer and shows error again, but after rerun the second time, the error disappeared. And the macro name is&amp;nbsp; not resolved from %do statement.&amp;nbsp; Actually, the VIS_S was already resolved to 6-7-8-9-10.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; %do jj=1 %to %sysfunc(countw(&amp;amp;vis_s,%str(-)));
        %let visn=%scan(&amp;amp;vis_s,&amp;amp;jj, -);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    select  avisitn into: vis_s separated by "-"
        from avisit
            where paramcd="&amp;amp;paramcd." %if %upcase(&amp;amp;paramcd)=PNIF or   %upcase(&amp;amp;paramcd)=EQ5D0206 or  %upcase(&amp;amp;paramcd)=SEV %then %do; and avisitn&amp;lt;=8 %end;
    ;
quit;

%put &amp;amp;vis_s;

%include mac_a(ancova_wocf_mi.sas);

    %do jj=1 %to %sysfunc(countw(&amp;amp;vis_s,%str(-)));
        %let visn=%scan(&amp;amp;vis_s,&amp;amp;jj, -);
        %put &amp;amp;visn;
		%ancova_wocf_mi(data=&amp;amp;data., paramcd=&amp;amp;paramcd., chgorpchg=&amp;amp;chgorpchg., avisitn=&amp;amp;visn., censornum=&amp;amp;censornum., popoth=&amp;amp;popoth.);
		%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_all.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23501i189DC610E3C30DD8/image-size/large?v=v2&amp;amp;px=999" role="button" title="_all.PNG" alt="_all.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 03:46:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498634#M132562</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-25T03:46:31Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498636#M132564</link>
      <description>&lt;P&gt;Thanks again, I am trying to find the root reason. will update once the issue was fixed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2018 03:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498636#M132564</guid>
      <dc:creator>Juanjuan</dc:creator>
      <dc:date>2018-09-25T03:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: The macro variable name is either all blank or missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498720#M132609</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/182408"&gt;@Juanjuan&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="_all.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23501i189DC610E3C30DD8/image-size/large?v=v2&amp;amp;px=999" role="button" title="_all.PNG" alt="_all.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The error message you posted has nothing to do with the code you posted. The only way to generate that error message is if you were trying to use the value of a macro variable as the name of the macro variable to use as you %DO loops index variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;49    %macro test(mvar_name);
50    %do &amp;amp;mvar_name=1 %to 2;
51      %put MVAR_NAME=|&amp;amp;mvar_name| &amp;amp;mvar_name=|&amp;amp;&amp;amp;&amp;amp;mvar_name| ;
52    %end;
53    %mend test;
54    %test(fred);
MVAR_NAME=|fred| fred=|1|
MVAR_NAME=|fred| fred=|2|
55    %test();
ERROR: The macro variable name is either all blank or missing.
ERROR:  is an invalid macro variable name for the index variable of the %DO loop.
ERROR: The macro TEST will stop executing.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Perhaps the problem is as simple as an unwanted ampersand?&lt;/P&gt;
&lt;P&gt;Setting the SYMBOLGEN option should let you find out what macro variable is being used in this way and make it easier to locate in your code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;56    options symbolgen;
57    %test();
SYMBOLGEN:  Macro variable MVAR_NAME resolves to
ERROR: The macro variable name is either all blank or missing.
ERROR:  is an invalid macro variable name for the index variable of the %DO loop.
ERROR: The macro TEST will stop executing.
58    options nosymbolgen;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Sep 2018 13:45:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-The-macro-variable-name-is-either-all-blank-or-missing/m-p/498720#M132609</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-25T13:45:34Z</dc:date>
    </item>
  </channel>
</rss>

