Date: Wed, 3 Jan 2001 10:36:50 -0500
Reply-To: "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject: Re: CODE BOOK FROM an as yet undocumented SAS DATA SET
Content-Type: text/plain; charset="iso-8859-1"
> From: Kevin F. Spratt [mailto:kevin-spratt@UIOWA.EDU]
> I just received an SPSS portable file and have used the
> convert procedure to create a SAS data set. I am
> using SAS 8.1 under WinNT.
> My question is how I can create an output data set with
> all of the variable names in one column so that I can
> send this back to the student so that they can write in
> appropriate variable name labels and, based on the frequency
> table I send, assign formats for each variable.
> For example: in a two variable data set:
> variable, label=, , format:,
> id , label=,subject id , format:,.
> sex , label=,subject gender , format:,0=Male, 1=Female
> If there is a better way, I would be glad to hear it.
you can start with proc CONTENTS
either take the output text and work with that
or create a data set from CONTENTS and run it thru either PRINT or report
proc CONTENTS data = LIBRARY.WHATEVER
out = CONTENTS
(keep = Name Format Label Length
you will want to specify whether a variable is character or numeric
and its appropriate length.
in your above example, sex may be numeric, and its default length would be 8
since this is clearly a binary-valued variable and could be stored as an
you could store it in at most 4 bytes and depending on your system either as
few as 2 or 3.
you want real space savings: use character 1.
and by the way: zero is Female, one is Male
gotta keep the Yin and Yang straight even in the data world ;-)
Ron Fehd the Yin&Yang maven CDC Atlanta GA USA RJF2@cdc.gov
OpSys: WinNT Ver: 8.1
---> cheerful provider of UNTESTED SAS code!*! <---
e-mail your SAS improvements to: email@example.com
If you always try to be logical,
you probably won't ever have much sorrow,
or much fun.
-- Ashleigh Brilliant pot-shot #4438