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

Hi Guys,

 

How to view all tables and its variable names, type and length in a library?

 

The registered library name is CDSSTG. Currently it has alot of SAS Datasets in it and each of the tables has its own Columns, type and length.

 

I tried proc contents:

 

proc contents data=CDSSTG._all_ nods; run;

I also tried proc datasets:

proc datasets lib=CDSSTG;
run;

 

But i am not getting the full columns attributes.

proc contents.PNG

Need your guidance. Also, i would like to list the full list, not just limited to 10 rows.

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You are mixing up usages here, clarify what you wat to do.  In the code you provide you are creating macro variables for each column.  From your original description you want dataset which holds all the metadata from that library - this already exists in the form of the SASHELP library (dictionarys is the SQL version of the same thing), so to get what you originally wanted then:

data want;
  set sashelp.vcolumn (where=(libname="CDSSTG"));
run;

This wil create a dataset want with all the column metadata.  If you can provide more clarified information as to what you want this can be adapted.  

View solution in original post

5 REPLIES 5
imdickson
Quartz | Level 8
Guys, when i remove nods in proc contents, it will show the table variables(full column names, type, and length) but it is only limited to 10 tables. May i know if there is a way to show all tables instead of the first 10?
imdickson
Quartz | Level 8
Hey, in proc sql, when i put create table name as ( , it will show error.

my current code is :

select name,memname
INTO:Name1-:Name%left(&NObs) ,:Table
from dictionary.columns
where libname = 'CDSSTG';
quit;

i would like to put this data into a sas dataset. Is there a way?
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You are mixing up usages here, clarify what you wat to do.  In the code you provide you are creating macro variables for each column.  From your original description you want dataset which holds all the metadata from that library - this already exists in the form of the SASHELP library (dictionarys is the SQL version of the same thing), so to get what you originally wanted then:

data want;
  set sashelp.vcolumn (where=(libname="CDSSTG"));
run;

This wil create a dataset want with all the column metadata.  If you can provide more clarified information as to what you want this can be adapted.  

imdickson
Quartz | Level 8
tHANKS alot. This is the code that i want. I need the data that i got from the dictionary. Now i can store it in my own dataset.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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