I am running the following code, but when calling the macro-variable I just created, "dir", libname does not work. As you can see, the "dir" macro-variable is the EXACT same path used to create the library testa, which successfully creates the library.
libname testa 'C:\Users' ;
%let dir = C:\Users;
libname testb '&dir';
libname testc '&dir.';
libname testd ' &dir ';
libname teste ' &dir. ';
Every time I run this code, I get the same 'NOTE: Library TEST_X_ does not exist.' message for each test, i.e., TESTB, TESTC, TESTD, & TESTE. (For brevity, I did not include ALL of those error messages.)
159 libname testa 'C:\Users' ;
NOTE: Libref TESTA was successfully assigned as follows:
Engine: V9
Physical Name: C:\Users
160 %let dir = C:\Users;
161 libname testb '&dir';
NOTE: Library TESTB does not exist.
Your help is appreciated!
The macro processor ignores text that is bounded on the outside by single quotes.
Use double quotes instead if you want the macro processor to see the macro variable reference.
libname testa 'C:\Users' ;
%let dir = C:\Users;
libname testb "&dir";
The macro processor ignores text that is bounded on the outside by single quotes.
Use double quotes instead if you want the macro processor to see the macro variable reference.
libname testa 'C:\Users' ;
%let dir = C:\Users;
libname testb "&dir";
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.