BookmarkSubscribeRSS Feed
BarryP
Quartz | Level 8

Hi all, if I want to access a table in one of the server location, I know to use a libname statement to assign the library, and then look up the libref of the table I want to use.  I can write, for example:

Data New_Table;

     set ABCDE.Table_in_Library;

run;


Where ABCDE is the libref of the table.



Is there a way to do this if the table is stored in the folder section?  Or will I need to export the table and then import it into a library under one of the servers?

Thanks!

6 REPLIES 6
Jagadishkatam
Amethyst | Level 16

please assign the libref to the path where the table is located as below

 

libname xyz '~path';

data want;
set xyz.table1;
run;
Thanks,
Jag
Tom
Super User Tom
Super User

Your words are confusing. 

 

By TABLE do you mean a SAS dataset? That is a physical file on the disk somewhere that has the extension 'sas7bdat'.

 

What do you mean by "folder section"?  Are you talking about a directory on the disk somewhere?  How is this location any different than the directory name that you used to create the libref you named ABCDE ?

 

Note that do not need to first create a libref to reference a SAS datsaet.  You can also reference it directly by using the quoted physical name of the file. 

 

So these two data steps are doing the same thing. 

libname abcde '/some/directory/name';
data one;
  set abcde.Table_in_Library;
run;

data one;
  set "/some/directory/name/table_in_library.sas7bdat";
run;

Notice how the physical filename uses lowercase for the name of the dataset. This is critical if SAS running on Unix as file names are case sensitive and SAS always writes into and looks to read from filenames that are in lowercase. (You can have mixed case in the directory/path/folder name)

BarryP
Quartz | Level 8

Ok, I clicked on the properties of what I want to use.  It says it is a "data set" and it showed me a folder path.  I typed is in exactly as shown below.  There was no extension shown on the dataset, but when I try to export it sas7bdat shows up as the default extension.

When I run the following code, it says that the folder path does not exist.  I've typed it in several times to make sure that it isn't a spelling error.

 

 


data test123;

 

set "/BAS Platform/010 Data Access/010 BAS/000 Meta/calendar.sas7bdat";

 

run;

 

 

 

Thanks again for the help.

BarryP
Quartz | Level 8

Hi, sorry I'm late responding.  I was on vacation.

In the upper right hand side of my SAS Enterprise Guide I can select an icon that says "servers" and I can select an icon right next to it that says "folders."  When I click on servers, I get a list of servers, libraries, tables, etc. that I can go through.  If I double click on a "table," or "data set" or whatever the term is, I can see the contents of it.  If I'm writing SAS code, I can use a libname statement to activate the library, and I can use the libref of the "folder" that the table is in.  Example:

Libname statement.............

Data want;

      set libref.tablename;
run;


What I am asking is whether or not I can use SAS Code to access tables/datasets/whatevertheyarecalled that are located in the "folders" section instead of the server section.

I honestly have no idea how or where these are stored or what the functionality is. All I know is that there is information that some department in my company put under "folders" instead of under "servers." 

Thanks a lot.  I apologize for my lack of knowledge on the topic.

Tom
Super User Tom
Super User

No idea what EG is doing.

Did you try seeing if they assigned as filerefs?

Submit this SAS statement to run and see what filerefs are defined in your SAS session.

filename _all_ list;
BarryP
Quartz | Level 8

I get this in a log.  Not sure what it's supposed to be showing me;

1 The SAS System 21:02 Wednesday, October 2, 2019

1 ;*';*";*/;quit;run;

2 OPTIONS PAGENO=MIN;

3 %LET _CLIENTTASKLABEL='Program (11)';

4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';

5 %LET _CLIENTPROJECTPATH='';

6 %LET _CLIENTPROJECTPATHHOST='';

7 %LET _CLIENTPROJECTNAME='';

8 %LET _SASPROGRAMFILE='';

9 %LET _SASPROGRAMFILEHOST='';

10

11 ODS _ALL_ CLOSE;

12 OPTIONS DEV=ACTIVEX;

13 GOPTIONS XPIXELS=0 YPIXELS=0;

14 FILENAME EGSR TEMP;

15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR

16 STYLE=HTMLBlue

17 STYLESHEET=(URL="file:///D:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")

18 NOGTITLE

19 NOGFOOTNOTE

20 GPATH=&sasworklocation

21 ENCODING=UTF8

22 options(rolap="on")

23 ;

NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR

24 FILENAME EGXLSSX TEMP;

25 ODS EXCEL(ID=EGXLSSX) FILE=EGXLSSX STYLE=Excel

26 OPTIONS (

27 EMBEDDED_TITLES="no" EMBEDDED_FOOTNOTES="no" SHEET_INTERVAL="None"

28 );

WARNING: Unsupported device 'ACTIVEX' for EXCEL(EGXLSSX) destination. Using device 'ACTXIMG'.

29

30 GOPTIONS ACCESSIBLE;

31

32 filename _all_ list;

NOTE: Fileref= EGSR

Physical Name= /sas/saswork_das/SAS_work122700002C60_shcsbiapp1vp/#LN00185

NOTE: Fileref= EGXLSSX

Physical Name= /sas/saswork_das/SAS_work122700002C60_shcsbiapp1vp/#LN00186

NOTE: Fileref= STDIN

Physical Name= <standard input>

NOTE: Fileref= STDOUT

Physical Name= <standard output>

NOTE: Fileref= STDERR

Physical Name= <standard error>

NOTE: Fileref= FILDES03

Physical Name= <File Descriptor 03>

NOTE: Fileref= FILDES04

Physical Name= <File Descriptor 04>

NOTE: Fileref= FILDES05

Physical Name= <File Descriptor 05>

NOTE: Fileref= FILDES07

Physical Name= <File Descriptor 07>

NOTE: Fileref= FILDES08

Physical Name= <File Descriptor 08>

NOTE: Fileref= FILDES09

Physical Name= <File Descriptor 09>

33

34 GOPTIONS NOACCESSIBLE;

2 The SAS System 21:02 Wednesday, October 2, 2019

35 %LET _CLIENTTASKLABEL=;

36 %LET _CLIENTPROCESSFLOWNAME=;

37 %LET _CLIENTPROJECTPATH=;

38 %LET _CLIENTPROJECTPATHHOST=;

39 %LET _CLIENTPROJECTNAME=;

40 %LET _SASPROGRAMFILE=;

41 %LET _SASPROGRAMFILEHOST=;

42

43 ;*';*";*/;quit;run;

44 ODS _ALL_ CLOSE;

NOTE: Writing EXCEL(EGXLSSX) file: /sas/saswork_das/SAS_work122700002C60_shcsbiapp1vp/#LN00186

45

46

47 QUIT; RUN;

48

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 1085 views
  • 0 likes
  • 3 in conversation