I get something different when I run your code on 9.3 Win 7 , 32 bits :
dd= rc=-70008 msg=NOTE: Library WC000001 does not exist. _ERROR_=0 _N_=1
dd=#LN00010 rc=0 msg= _ERROR_=0 _N_=1
PG
Did you use tilde ~? You need the proper path syntax for your OS. I am UNIX and ~ means "home".
Yeah. If I use a period (current dir in Windows), I match your output :
dd= rc=0 msg= _ERROR_=0 _N_=1
dd=#LN00010 rc=0 msg= _ERROR_=0 _N_=1
Looks like a case for Tech Support... But then, is name generation an official feature of SAS?
PG
It seem like is must be a feature because SAS does generate the name and define the libref, note RC=0. I just don't know how to get SAS to tell me what that name is.
But you may be right "we ain't s'pose to it that way".
The automatic macro variable &SYSLAST will have the library and dataset name of the last created dataset. Parse the string for the library
%let lastlib = %scan(&syslast,1,'.');
%put &lastlib;
The code is just making librefs, not creating any datasets, so SYSLAST macro variable will not be updated.
Seems to be how it works. Perhaps you can put it on the SAS ballot.
Meanwhile use FILENAME to generate the new name. You will need to modify it slightly to make it valid.
data _null_;
length fileref libref $8;
* Make FILEREF ;
fileref = ' ';;
rc = filename(fileref,'~');
msg = sysmsg();
put _all_;
* Generate LIBREF from FILEREF ;
libref='_'||substr(fileref,2);
* clear FILENAME ;
rc = filename(fileref,' ');
msg = sysmsg();
put _all_;
* Generate LIBNAME ;
rc = libname(libref,'~');
msg = sysmsg();
put _all_;
run;
fileref=#LN00023 libref= rc=0 msg= _ERROR_=0 _N_=1
fileref= libref=_LN00023 rc=0 msg= _ERROR_=0 _N_=1
fileref= libref=_LN00023 rc=0 msg= _ERROR_=0 _N_=1
I thought about that but ended up just using &SYSINDEX.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.