BookmarkSubscribeRSS Feed
santhoshlekkala
Calcite | Level 5

hello everyone,

 

few days back i have attended an interview, the interviewer asked a question:-

consider a case, there are 50 libraries, each libraries has some sas datasets. so i want to list only those sasdatas  which has a column or variable X in all the sas datasets from all the libraries?????

plzz help me 

4 REPLIES 4
Jagadishkatam
Amethyst | Level 16

Ok in this case, sashelp.vcolumns will help us. in this we could check all the libraries, datasets and the variables they have.

 

in your case check like this

 

data want;

set sashelp.vcolumns;

where name='X';

run;

 

This will subset on the list of libraries(libname) and datasets (memname) that have variable with name X.

Thanks,
Jag
Jagadishkatam
Amethyst | Level 16

Alternatively by proc sql also we could achieve the same result

 

proc sql;
create table want as select libname, memname , name from dictionary.columns where name='X';
quit;


Thanks,
Jag
Reeza
Super User

They wanted to know if you're familiar with Dictionary tables. 

 

You can find details in many papers on LEXJANSEN.COM

 

Common usages: 

Create data dictionary

Automate creation of labels or rename variables 

 

santhoshlekkala
Calcite | Level 5

tq for help

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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