DATA Step, Macro, Functions and more

create dummy variables, using one as reference

Reply
Super Contributor
Posts: 345

create dummy variables, using one as reference

based on what I have learned, to create dummy variables, needs to create n-1 level of variables.

however, now I need to create as one variable with several levels.

for example, for agegroup I need to have one as a reference, with each level higher being 1,2,and 3.

 

I remember that I used Stata to create similiar dummy variables, but do not know how to do that with SAS.

Can anybody give advice, or provide reference?

Thanks.

Super User
Posts: 19,768

Re: create dummy variables, using one as reference

Rick Wicklins blog

http://blogs.sas.com/content/iml/2016/02/22/create-dummy-variables-in-sas.html

 

SAS UCLA

http://www.ats.ucla.edu/stat/sas/faq/dumvars.htm

 

My post - on here ...

https://communities.sas.com/t5/SAS-Statistical-Procedures/How-to-create-dummy-variables-Categorical-...

 

Last, but not least, several proc support the CLASS statement where SAS will deal with creating the dummy variables. Some Procs allow you to specify the reference level and parameterization type, but others don't so make sure to read the docs for the proc you're using. 

 

Ask a Question
Discussion stats
  • 1 reply
  • 185 views
  • 1 like
  • 2 in conversation