Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searching for a column

Status
Not open for further replies.

ken2834

Technical User
Jun 26, 2006
27
US
Here's a silly question. I have a dataset open in SAS 6.1.2 and my dataset has 700 to 800 columns, not in alphabetical order. I am trying to search for a particular column name, and I think I know part of the name. The 'Find' function only enables me to search data. How can I search for a column name?

Thanks.
 
Hmmm. That's a tough one.

OK, simplest way is probably to do a proc contents, copy the results into notepad or something like that and search there.

To be honest, I haven't used 6.1.2 in years so I'm not sure if any of my other methods would apply. You could always try querying the dictionary.columns meta-table
Code:
proc sql;
  create table columns as
  select *
  from dictionary.columns
  where libname = <your libname>
    and memname = <dataset name>
  ;
quit;
Be careful with this query. If you leave out the where clause, it'll return every column for every table in every library that you have defined. Also, the lib and memnames are in uppercase.

Finally, and I think this is only in version 8 and above, if you find the dataset in the Explorer window in your SAS session, you can right click, select "columns", then right click in the columns listing and select "copy" and it'll copy all the column names (and other info) into your clipboard. Then you can paste it into notepad etc.

Enjoy.
ChrisW75
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top