-1

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.

Ullas
  • 11,450
  • 4
  • 33
  • 50
  • What have you tried? Which PROC are you using? Depending on the PROC some have ways to account for this where you don't have to convert to procreate your dummy variables, just specify the reference level and method of parameterization. – Reeza Sep 30 '18 at 23:03

1 Answers1

0

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.

Craig Srsen
  • 465
  • 4
  • 8