Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Summary

Status
Not open for further replies.

ruffers

Technical User
Jul 22, 2008
2
GB
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?
 
Hi Ruffers,

By value labels, I think you are referring to formats. This information is provided by the defualt proc contents under "formats".

Code:
proc contents data=have;
run;


output:
 Variable    Type    Len    Format
  text        Char      8
  val         Num       8    TEST.

HTH
 
Thanks kdt82,

By value labels I mean, for example, with a variable called COUNTRY I would have:

1. France
2. Germany
3. Italy
4. Spain
5. UK

I need to find a way to have these options included in my summary list of variables.
 
Ok so you want to see the formats associated with a variable.

To see the contents of the formats catalog you can use the following

Code:
proc format fmtlib;
run;

To see this in a table form.

Code:
proc format fmtlib out=tformats;
run;

Or use the following to code to create a table displaying all variables, and displaying variables with formats unformatted and formatted (prefixed with _). I have included a dummy dataset to show how it works

Code:
proc format;
    value test 1='one'
               2='two'
               3='three'
    ;
run;

data have;
format val test.;
input val text$;
cards;
1 this
2 is a
3 test
;
run;

proc sql noprint;
select compress(name|| "= _" || name) 
into :l_value
from dictionary.columns 
where memname="HAVE" and format;
quit;

data want;
set have;
format _all_;
set have(rename=(&l_value));
run;

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top