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;
_________________________
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?
Correction
Code1 is
proc sql;
create table mTable as
select * from dictionary.columns
where libname = 'sashelp'
;
quit;
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?
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.
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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.