I am performing regression where I make dummy variable for categorical variable. where I have a categorical variable i.e
agecategory
1
2
3
4
5
I would like to know how can I define dummy variable of this categorical variable in SAS
.
I am performing regression where I make dummy variable for categorical variable. where I have a categorical variable i.e
agecategory
1
2
3
4
5
I would like to know how can I define dummy variable of this categorical variable in SAS
.
In your DATA step:
array agecat(*) agecategory1 - agecategory5;
do i=1 to dim(agecat);
if agecategory=i then agecat[i]=1;
else agecat[i]=0;
end;
This is assuming your agecategory variable is numeric, not character.