The NVALID function accepts all VALIDVARNAME values in the SAS 9.4M7 (TS1M7) release


Beginning with the SAS 9.4M7 release, the NVALID function accepts a value of UPCASE for the second argument. If the second argument is omitted, the value of the VALIDVARNAME system option is used to make the determination.

In earlier SAS releases, the UPCASE argument did not provide correct results.

Both examples below demonstrate that the NVALID function reports correctly the validity of a character string for use as a SAS variable name. Because the VALIDVARNAME value is UPCASE, V is not valid whereas V2 is valid. 

/* The second argument specifies the setting of the VALIDVARNAME system option to make the determination. */

data a;
   v=nvalid('x','upcase');
   v2=nvalid('X','upcase');
run;
 
proc print;
run;

-----------------------------------------------------------------

/* A second argument is not supplied for NVALID so the VALIDVARNAME system option is used. */

options validvarname=upcase;

data a;
   v=nvalid('x');
   v2=nvalid('X');
run;
 
proc print;
run;