The following code will generate a LIBREF named as MC0000nn. But I cannot figure out how to know the generated name. The FILENAME function has similar feature that populates the variable with the generated FILEREF.
6
7 data _null_;
8 length libref $8;
9 libref = ' ';
10 rc = libname(libref,'.');
11 msg = sysmsg();
12 put _all_;
13 run;
libref= rc=-70004 msg=NOTE: Libref refers to the same physical library as SASUSER. _ERROR_=0 _N_=1
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
SASHELP.VLIBNAM before and after.
Before
After
Not too sure why you'd want to define a nameless library, but you can get the name by defining another library that points to the same location:
data _null_;
length LIBREF $8;
LIBREF = ' ';
RC = libname(LIBREF,'.');
RC = libname(LIBREF,'.');
MSG = sysmsg();
put _all_;
run;
LIBREF= RC=-70004 MSG=NOTE: Libref refers to the same physical library as WC000001. _ERROR_=0 _N_=1
A bit wasteful but better than nothing?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.