I am having a problem I believe involves the resolution of a macro variable in a dataset name. It appears a space is being inserted between the first part of the name and the macro variable reference value, so that, instead of 1 name, I end up with 2 names. Below is sample code, and the log. The code was submitted immediately after SAS invocation (v9.4). The purpose of the %put and put statements is to show what the macro variable is resolving to.   %macro datatype(type);
  %global nmend;
  %if &type=enrolled %then %do;
    %let nmend=%str(enrl);
  %end;
  %else %do;
    %let nmend=%str(elig);
  %end;
%mend datatype;
%macro table1_3;
%put ***&nmend.***;
%put ***tbl1_3_&nmend.***;
%put ***%str(tbl1_3_&nmend.)***;
  data tbl1_3_&nmend.;
    name='Dave';
    age=22;
put "&nmend.";
put "tbl1_3_&nmend.";
put "%str(tbl1_3_&nmend.)";
    output;
  run;
%mend table1_3;
%datatype(elig)
%put &=nmend;
%table1_3    MLOGIC(DATATYPE):  Beginning execution.
MLOGIC(DATATYPE):  Parameter TYPE has value elig
MLOGIC(DATATYPE):  %GLOBAL  NMEND
SYMBOLGEN:  Macro variable TYPE resolves to elig
MLOGIC(DATATYPE):  %IF condition &type=enrolled is FALSE
MLOGIC(DATATYPE):  %LET (variable name is NMEND)
MLOGIC(DATATYPE):  Ending execution.
54   %put &=nmend;
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
NMEND=elig
55   %table1_3
MLOGIC(TABLE1_3):  Beginning execution.
MLOGIC(TABLE1_3):  %PUT ***&nmend.***
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
***elig***
MLOGIC(TABLE1_3):  %PUT ***tbl1_3_&nmend.***
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
***tbl1_3_elig***
MLOGIC(TABLE1_3):  %PUT ***tbl1_3_&nmend.***
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
***tbl1_3_elig***
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
MPRINT(TABLE1_3):   data tbl1_3_elig;
MPRINT(TABLE1_3):   name='Dave';
MPRINT(TABLE1_3):   age=22;
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
MPRINT(TABLE1_3):   put "elig";
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
MPRINT(TABLE1_3):   put "tbl1_3_elig";
SYMBOLGEN:  Macro variable NMEND resolves to elig
SYMBOLGEN:  Some characters in the above value which were subject to macro quoting have been unquoted for printing.
MPRINT(TABLE1_3):   put "tbl1_3_elig";
MPRINT(TABLE1_3):   output;
MPRINT(TABLE1_3):   run;
elig
tbl1_3_elig
tbl1_3_elig
NOTE: The data set WORK.TBL1_3_ has 1 observations and 2 variables.
NOTE: The data set WORK.ELIG has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds
MLOGIC(TABLE1_3):  Ending execution.
   It appears the dataset has one name, tbl1_3_elig, but I end up with 2 datasets, tbl1_3_ and elig! I have done things like this zillions of times in the past and never encountered this. Any suggestions as to what's going on? Did I inadvertently set some kind of environmental variable that's causing this? 
						
					
					... View more