BookmarkSubscribeRSS Feed
hdg
Obsidian | Level 7 hdg
Obsidian | Level 7

hello

I have a library which i have defined as test for example libname test "C:\temp";

there are some active libraries like maps for example and i want to know how do i find the location in which the datasets are stored.

I can do that if I just right click and see properties but how do i programatically locate where the datasets are being stored in the  C drive

Thank you

4 REPLIES 4
ballardw
Super User

One way

 

proc sql;

select path

from dictionary.libnames

where libname="WORK";

quit;

This will show in the results window. You can drop the value into a macro variable for use elsewhere in your program using

INTO on the select statement probably with NOPRINT

Haikuo
Onyx | Level 15

Not sure if I understand 1) What libraries you are talking about, I assume they are those predefined libraries you see out of box? as if you define it, you know where it is. 2) What do you mean "pragmatically"

Anyway, the definition of those predefined libraries (eg. SASHELP, MAPS etc) can be found in either SASv9.cfg (most likely) or autoexec.sas

for instance, you will find statements like this in cfg file:

-SET SASROOT "C:\Program Files\SASHome\x86\SASFoundation\9.3"

-MAPS !SASROOT\maps

meaning library maps is located in 

C:\Program Files\SASHome\x86\SASFoundation\9.3\maps

In autoexec.sas, you will just see those libname statements if there are any.

Regards,

Haikuo

Haikuo
Onyx | Level 15

Inspired by , I think now I know what you mean by "pragmatically" , here is another one using a SAS function PATHNAME:

data _null_;

path=pathname('work');

put path=;

run;

Regards,

Haikuo

Ksharp
Super User

%let x=%sysfunc(pathname(maps));

%put &x ;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 3031 views
  • 0 likes
  • 4 in conversation