Desktop productivity for business analysts and programmers

Finding Column name in Schema using SAS EG

Accepted Solution Solved
Reply
Occasional Learner
Posts: 1
Accepted Solution

Finding Column name in Schema using SAS EG

Hi, I am relatively new to SAS programming.

 

I am trying to locate tables with a column name (or like if possible) from a library in SAS EG.

 

I use to have a code for this in SAS base where it hits dictionary.columns but that does not work for SAS EG.

 

Can anyone please assist? 

 

Following is the SAS base code I use to use

proc sql ;
  select name 
  from dictionary.columns
  where memname = 'mydata'
  ;
quit ;

 Thank you.


Accepted Solutions
Solution
‎02-17-2017 04:19 PM
Esteemed Advisor
Posts: 6,696

Re: Finding Column name in Schema using SAS EG

Use

select memname from dictionary.columns
where upcase(name) = 'MYCOL' and upcase(libname) = 'MYLIB'

to find all datasets in mylib that have a column mycol.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎02-17-2017 04:19 PM
Esteemed Advisor
Posts: 6,696

Re: Finding Column name in Schema using SAS EG

Use

select memname from dictionary.columns
where upcase(name) = 'MYCOL' and upcase(libname) = 'MYLIB'

to find all datasets in mylib that have a column mycol.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super Contributor
Posts: 406

Re: Finding Column name in Schema using SAS EG

In EG it is often easier to use the views on the dictionary tables as they can be found in the SASHELP library. In your case the view would be SASHELP.VCOLUMN.

 

You can drop this table on the canvas and use a filter&sort or query builder on it.

 

I hope this helps,

- Jan.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 202 views
  • 0 likes
  • 3 in conversation