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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

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
  • 6 replies
  • 1385 views
  • 0 likes
  • 3 in conversation