hello everyone,
my code is as below:
%let dirdata='/folders/myfolders';
libname perm '&dirdata';
run;
And the LOG shows:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 %let dirdata='/folders/myfolders'; 74 libname perm '&dirdata'; NOTE: Library PERM does not exist. 75 run; 76 77 78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 91
I wonder if there is any method to create a permanent libname in SAS Studio?
Is there anyone kindly tell me what did I do wrong?
Thanks!
Macro variables only resolve in double quotes, not single quotes.
@jc3992 wrote:
hello everyone,
my code is as below:
%let dirdata='/folders/myfolders'; libname perm '&dirdata'; run;
And the LOG shows:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 %let dirdata='/folders/myfolders'; 74 libname perm '&dirdata'; NOTE: Library PERM does not exist. 75 run; 76 77 78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 91I wonder if there is any method to create a permanent libname in SAS Studio?
Is there anyone kindly tell me what did I do wrong?
Thanks!
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 %let dirdata= "/folders/myfolders"; 74 libname perm "dirdata"; NOTE: Library PERM does not exist. 75 run; 76 77 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 90
still did not work though
73 %let dirdata= "/folders/myfolders/"; 74 libname perm "dirdata";
Does that work?
Did you update SAS UE? I thought we'd worked through this a few weeks ago.
No that did not work.
Last weekend I was using SAS 9.4 on the computer lab
now the same problem happened with SAS Studio
@jc3992 wrote:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 %let dirdata= "/folders/myfolders"; 74 libname perm "dirdata"; NOTE: Library PERM does not exist. 75 run; 76 77 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 90still did not work though
No miracle. You deleted the necessary ampersand. Try
%let dirdata=/folders/myfolders;
libname perm "&dirdata";
I succeeded by the code as below:
%let dirdata=/folders/myfolders;
libname perm "&dirdata";
run;
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72 73 74 %let dirdata=/folders/myfolders; 75 libname perm "&dirdata"; NOTE: Libref PERM was successfully assigned as follows: Engine: V9 Physical Name: /folders/myfolders 76 run; 77 78 79 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 92
Right...you had double quotes in each location, it goes in one or the other.
But like I mentioned before, you really don't need the macro variable step at all. And macros are just confusing in the beginning.
If you do want to work with macros, first make sure you have working code and then start adding the macro components.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.