affiliation 发表于 2011-8-8 22:20 
Could you give the code please? Thanks.
for example, the the value of the categorical variable, named color, is 1 if red, 2 yellow, 3 if green.
gen red=0
replace red=1 if color==1
gen yellow=0
replace yellow=1 if color==2
gen green=0
replace green=1 if color==3