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. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 6 replies
  • 863 views
  • 3 likes
  • 3 in conversation