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

Hello 

I've used code1 below to check all the variables names in different libraries it worked flawlessly, however when I used it to read from the Sashelp library it keeps giving me an empty table. it seems that sas is not reading the library in this code specifically, however, if I tried to print the data in one of sashelp files (per code2 below) it reads it and show me the result. may you help me understanding my mistake in code1 

code1

__________________________

proc sql;
create table mTable as 
select * from dictionary.columns 
where libname = 'sashelp'

and memname ='filename' ;
quit;
_________________________

 

code2

_________________________

proc print data=sashelp.Cars;

run;

_________________________

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
where libname = 'sashelp'

should be

 

where libname = 'SASHELP'

the capital letters make a difference.

 

Also this won't work: 

 

and memname ='filename' ;

because there are no memnames (which are data set names) that have the name 'filename' or 'FILENAME'. So its not clear to me what you are doing. What are you trying to do?

--
Paige Miller

View solution in original post

4 REPLIES 4
Abdulla1
Quartz | Level 8

Correction 

Code1 is 

proc sql;
create table mTable as
select * from dictionary.columns 
where libname = 'sashelp' 
;
quit;

PaigeMiller
Diamond | Level 26
where libname = 'sashelp'

should be

 

where libname = 'SASHELP'

the capital letters make a difference.

 

Also this won't work: 

 

and memname ='filename' ;

because there are no memnames (which are data set names) that have the name 'filename' or 'FILENAME'. So its not clear to me what you are doing. What are you trying to do?

--
Paige Miller
Abdulla1
Quartz | Level 8

thanks @PaigeMiller 

I spent over 3 hour on that but didn't thought about changing them to capital letters!. 

the filename part was written as a comment in my original file coping it was a mistake. 

PaigeMiller
Diamond | Level 26

Suggestion: LOOK AT the dictionary table with your own eyes

 

proc sql;
    select distinct(libname) from dictionary.columns;
quit;

 or look at table SASHELP.VCOLUMN, it is dictionary table.

--
Paige Miller

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 644 views
  • 0 likes
  • 2 in conversation