I am very new to SAS and want to create a simple dummy variable (MALE
) that equals 1 if SEX = 1
, and equals 0 if SEX = 2
. However, I get error messages: ERROR: The decimal specification of 2 must be less than the width specification of 1.
How do I solve this? This is the code I use:
DATA WORK.BMI_D ;
SET WORK.BMI ;
IF SEX = 1 THEN MALE = 1;
ELSE MALE = 0;
RUN;
The variable SEX
has length 8
, type Numeric
and format F8.2
. What am I doing wrong?