BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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?
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
deleted_user
Not applicable
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!
Cynthia_sas
Diamond | Level 26
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
Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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