Help using Base SAS procedures

Data summary

Reply
N/A
Posts: 0

Data summary

I am trying to produce a list of information on all variables in a data set, including the name of each variable, it's variable label, and any value labels associated with it.

PROC CONTENTS appears to take care of the variable labels, but I cannot figure out how to include the value labels in this list.

Is there any way to do this?
Super Contributor
Super Contributor
Posts: 3,174

Re: Data summary

Posted in reply to deleted_user
It's unclear - your reference to "value label". SAS maintains variable labels and SAS member labels, but there is no "label information" associated with a given observation (row) within a SAS member. Can you provide more details about what you are trying to accomplish?

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Data summary

Hi - thanks for your reply,

by "value label" I mean, for example, in a variable called 'COUNTRY' I would have:
1. France
2. Germany
3. Italy
4. Spain
5. UK

It is these options I would like to display alongside the variable label if possible.

I hope you (or anyone else) is able to help with this additional information!
SAS Super FREQ
Posts: 8,862

Re: Data summary

Posted in reply to deleted_user
Hi:
Those look like the distinct levels of the variable values to me. You can get that from the NLEVEL option of PROC FREQ or a SELECT distinct in PROC SQL -- but NOT from PROC CONTENTS.

cynthia
SAS Super FREQ
Posts: 8,862

Re: Data summary

Posted in reply to deleted_user
Hi:
By "value labels" I figure you mean user-defined formats??? If so, PROC CONTENTS will only show you the name of the format. You would have to use PROC FORMAT to get the FMTLIB report on a particular format or formats. PROC FORMAT has a SELECT statement which allows you to get a report which will list a particular format or informat (or select a group of formats). You can also use the CNTLOUT feature of PROC FORMAT to create a SAS dataset from a format.

For more information on FMTLIB or CNTLOUT, consult the SAS documentation.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 142 views
  • 0 likes
  • 3 in conversation