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

I'm interested in know if I can invoke Proc Contents and input my dataset name and a short list of some of it's variable names (but not all) and have it return just the variable name and it's Type, Length, Format, and Informat? 

 

Any suggestions would be much appreciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Sure thing 🙂

 

ods select Variables;
ods output Variables=Variables;
proc contents data=sashelp.class(keep=name height);
run;

View solution in original post

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Something like this is probably the simplest

 

ods select Variables;
proc contents data=sashelp.class(keep=name height);
run;
buechler66
Barite | Level 11

wow this gives me great information.  Thank you.  Is there anyway to output this as a SAS dataset?

PeterClemmensen
Tourmaline | Level 20

Sure thing 🙂

 

ods select Variables;
ods output Variables=Variables;
proc contents data=sashelp.class(keep=name height);
run;
buechler66
Barite | Level 11
Thanks so much for the help. This is perfect. I appreciate you taking the time to help.
buechler66
Barite | Level 11
For the statement 'ods select Variables;'. Is the word Variables a SAS keyword that means something specific?
novinosrin
Tourmaline | Level 20

For applying filters , I am afraid you are better off querying metadata from dictionary tables.

 

However, you can use   dataset option with filters if you are writing the contents to an output dataset. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1027 views
  • 3 likes
  • 3 in conversation