I have to recode a trinary variable "a6a" : 1=small, 2=medium, 3=large. Into a binary variable "Size", 1=small, 0=medium-large. But I also want that the variable "Size" displays the label "small" and "medium-marge" for either 0 or 1 values.
I have this code, which works well :
Code:
gen byte size=a6a==1 label define sizelbl 0 "medium-large" 1 "small" label values size sizelbl
Thanks
0 Response to How to change a trinary variable into a binary with label in 1 line
Post a Comment