LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 7 Dec 2006 10:44:39 -0500
Reply-To:     Lei <kiki886@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Lei <kiki886@GMAIL.COM>
Subject:      How to change a categorical variable into a set of indicator
              variables?

Suppose I have a following dataset

Id a1 1 2 2 5 3 4 4 1

I want a1 to be expressed in a set of indicator variables. The number of indicator vars is determined by the max of a1. The result dataset needs to be like

id b1 b2 b3 b4 b5 1 0 1 0 0 0 2 0 0 0 0 1 3 0 0 0 1 0 4 1 0 0 0 0

Any input? TIA.


Back to: Top of message | Previous page | Main SAS-L page