Write and run SAS programs in your web browser

Can I create permanent libname in SAS Studio?

Reply
Frequent Contributor
Posts: 112

Can I create permanent libname in SAS Studio?

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!

Super User
Posts: 23,677

Re: Can I create permanent libname in SAS Studio?

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!


 

Frequent Contributor
Posts: 112

Re: Can I create permanent libname in SAS Studio?

 
 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

Super User
Posts: 23,677

Re: Can I create permanent libname in SAS Studio?

 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.  

Frequent Contributor
Posts: 112

Re: Can I create permanent libname in SAS Studio?

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

Super User
Posts: 10,211

Re: Can I create permanent libname in SAS Studio?

[ Edited ]

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";
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Frequent Contributor
Posts: 112

Re: Can I create permanent libname in SAS Studio?

Posted in reply to KurtBremser

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         
Highlighted
Super User
Posts: 23,677

Re: Can I create permanent libname in SAS Studio?

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.

Ask a Question
Discussion stats
  • 7 replies
  • 136 views
  • 1 like
  • 3 in conversation