LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 7 Aug 2008 23:08:29 -0700
Reply-To:   RolandRB <rolandberry@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   RolandRB <rolandberry@HOTMAIL.COM>
Organization:   http://groups.google.com
Subject:   Re: Format question
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Aug 7, 9:03 pm, sas...@GMAIL.COM (sas biology) wrote: > Hi Group, > > I am working on a old dataset which has a variable SEX with format sex. > This variable has values 1 and 2. Is there anyway I can know if the value > of 1=Male or female? Please let me know. > > Thanks > > SB

So long as you have the original format assiged to your sex variable then you can use the vformat() function to show you what the value is.

1 proc format; 2 value sex 3 0="Unknown" 4 1="Female" 5 2="Male" 6 ; NOTE: Format SEX has been output.

NOTE: PROCEDURE FORMAT used (Total process time): real time 0.04 seconds cpu time 0.03 seconds

7 data test; 8 sex=0;output; 9 sex=1;output; 10 sex=2;output; 11 format sex sex.; 12 run;

NOTE: The data set WORK.TEST has 3 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.03 seconds

13 data _null_; 14 length sexstr $ 12; 15 set test; 16 sexstr=putn(sex,vformat(sex)); 17 put sex=1. sexstr=; 18 run;

sex=0 sexstr=Unknown sex=1 sexstr=Female sex=2 sexstr=Male NOTE: There were 3 observations read from the data set WORK.TEST. NOTE: DATA statement used (Total process time): real time 0.01 seconds cpu time 0.01 seconds


Back to: Top of message | Previous page | Main SAS-L page