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.
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?
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.