|
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
|