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
SAS Super FREQ
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
SAS Super FREQ
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

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!

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.

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