BookmarkSubscribeRSS Feed
jc3992
Pyrite | Level 9

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!

7 REPLIES 7
Reeza
Super User

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;
 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!


 

jc3992
Pyrite | Level 9
 
 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

Reeza
Super User
 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.  

jc3992
Pyrite | Level 9

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

Kurt_Bremser
Super User

@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;
 90         

still did not work though


No miracle. You deleted the necessary ampersand. Try

%let dirdata=/folders/myfolders;
libname perm "&dirdata";
jc3992
Pyrite | Level 9

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         
Reeza
Super User

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1434 views
  • 1 like
  • 3 in conversation