BookmarkSubscribeRSS Feed
Lida
Obsidian | Level 7

Hello,

I try to obtain information about my sas data that are stored on a SAS server. I cannot understand what I am doing wrong. When I use the following code

 

proc sql;

   create table mytable as

     select * from sashelp.vcolumn

     where libname="RMTWORK";

quit;

*it worked;

 

But when I use the custom libname, the same code does not work. It appears to me that SAS EG cannot access see my library even it was successfully assigned.

 

 

libname SOD "/sas/sasusers/LLOUKINE/Sodium/Sodium 2016_2017/SASNielsenData/Nielsen 2016";

 

*NOTE: Libref SOD was successfully assigned as follows:

     Engine:       V9

     Physical Name: /sas/sasusers/LLOUKINE/Sodium/Sodium 2016_2017/SASNielsenData/Nielsen 2016

;

 

proc sql;

   create table mytable1 as

     select * from RTMSASHP.VCOLUMN

     where libname="SOD";

quit;

*it does not work. Table mytable1 is empty;

 

Why it did not work in SAS EG?

 Any idea why it does not work?

Thank you!

7 REPLIES 7
art297
Opal | Level 21

What is: RTMSASHP.VCOLUMN?

 

and, while that probably should be sashelp.vcolumn, since you're using proc sql why access the view, just use:

  from dictionary.columns

 

HTH,

Art, CEO, AnalystFinder.com

 

Lida
Obsidian | Level 7

sorry, I menat to sent this;

libname SOD "/sas/sasusers/LLOUKINE/Sodium/Sodium 2016_2017/SASNielsenData/Nielsen 2016";

*NOTE: Libref SOD was successfully assigned as follows:

Engine: V9

Physical Name: /sas/sasusers/LLOUKINE/Sodium/Sodium 2016_2017/SASNielsenData/Nielsen 2016

;

proc sql;

create table mytable1 as

select * from sashelp.vcolumn

where libname="SOD";

quit;

*it does not work. table mytable1 is empty. Why it did not work in SAS EG?;

 

at some point I noticed that SAS EG creates a libname called RTMSASHP, so itried to replace sashelp by RTMSASHP but it did not work anyway.

What I am trying to do is actually to read the names of files I have stored on a remote server, from the directory I point with the libname

 

ballardw
Super User

@Lida wrote:

sorry, I menat to sent this;

libname SOD "/sas/sasusers/LLOUKINE/Sodium/Sodium 2016_2017/SASNielsenData/Nielsen 2016";

not work anyway.

What I am trying to do is actually to read the names of files I have stored on a remote server, from the directory I point with the libname

 


From a SAS veiwpoint LIBRARIES contain SAS files such as data sets, views and catalogs. If the file is not used by SAS then access through a LIBRARY statement in SAS does not exist.

You could use a directory listing command referenced as a FILENAME to pipe the results of LS or DIR or whichever and read that as if it were text file to import into a SAS data set.

There are also a number of SAS external file functions to explore such as DOPEN, DINFO, DREAD and such related to directory (folder) information.

Kurt_Bremser
Super User

I guess that rtmsashp is a SAS/CONNECT remote reference to the server's sashelp?

I'm not surprised that the dynamically created dictionary tables don't work across that connection.

Run the query in an rsubmit and then download the resulting table.

Lida
Obsidian | Level 7

how exactly canI do it?

 

art297
Opal | Level 21

Out of curiosity, did you try:

 

proc sql;
  create table mytable1 as
    select * from dictionary.columns
      where libname="SOD"
  ;
quit;

Art, CEO, AnalystFinder.com

 

Lida
Obsidian | Level 7

yes, I did, the file comes empty..

 

8070 GOPTIONS ACCESSIBLE;

8071

8072 proc sql;

8073 create table mytable1 as

8074 select * from dictionary.columns

8075 where libname="SOD"

8076 ;

NOTE: Table WORK.MYTABLE1 created, with 0 rows and 18 columns.

8077 quit;

NOTE: PROCEDURE SQL used (Total process time):

real time 0.01 seconds

cpu time 0.01 seconds

 

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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