BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
fierceanalytics
Obsidian | Level 7

Hello, 

I inherited such code:

/**************************************/

Libname yy2 '  ';  /*nothing between the two quotes*/

data yy2;

  set ......;

run;

/**************************************/

Rerunning the code is fine, but YY2 shows up empty. Any idea what is going on? I know libname statement can be used in all kinds of fancy way, but EMPTY? The admin and the initial author of the code had some tacit agreement in CFG.... I would like to hear some thoughts to see if this is by design some built in SAS syntax before I chase down somebody. Thanks. Jia

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Run

libname yy2 list;

to see where this points. It should be the current working directory of the SAS process, which is in sasconf/Lev1/SASApp in the default configuration.

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

It is a good way to figure out what the current working directory is for your SAS session, but I would use a period instead of space in the quotes since that is normal syntax for current directory.

 

Most likely the code is designed to be run from the command prompt.

cd myprojectdir
sas myprogram

 

 

Kurt_Bremser
Super User

Run

libname yy2 list;

to see where this points. It should be the current working directory of the SAS process, which is in sasconf/Lev1/SASApp in the default configuration.

fierceanalytics
Obsidian | Level 7
See. So it is just naming the temp work directory. No wonder there is nothing there. Thanks. Jia
Tom
Super User Tom
Super User

@fierceanalytics wrote:
See. So it is just naming the temp work directory. No wonder there is nothing there. Thanks. Jia

Nope.  It is making a libref that points to the current directory. Useful for portable code.

fierceanalytics
Obsidian | Level 7
Well, actually it is NOT portable. Run as it, it bounced back saying the libref is not defined. If portable, it should have allowed through to my current work directory. I therefore think there was some specific setup back then. Not problem. I changed to explicit library location. Thanks. Jia
Tom
Super User Tom
Super User

Not sure what operating system you are using but that syntax works fine on Windows and Unix.

1  %put &=sysvlong &=sysscp;
SYSVLONG=9.04.01M5P091317 SYSSCP=WIN
2  libname here ' ';
NOTE: Libref HERE was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\.......

1   %put &=sysvlong &=sysscp;
SYSVLONG=9.04.01M5P091317 SYSSCP=LIN X64
2   libname here ' ';
NOTE: Libref HERE was successfully assigned as follows:
      Engine:        V9
      Physical Name: /home/....

But it is probably not very useful if you are launching SAS via some GUI tool instead of from the command line.  For example if you are launching SAS code using Enterprise Guide, SAS/Studio or even Microsoft Windows. In that case you should come up with another method to locate your datasets.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 2065 views
  • 0 likes
  • 3 in conversation