Dear Stata users,
As we know, when we recode a variable, we can define a new value label simultaneously. My question is about how to define value label more easily. Suppose we want to define a value label just corresponding to the recode rule, then we must write the same rule text in double quotes ( "" ). If there are a lot of recode rules, this work will be tedious. So, is there any way to get rid of that? That is to say, remove texts in double quotes ("1/10", for example) in the following codes, but attain the same outcomes.
As we know, when we recode a variable, we can define a new value label simultaneously. My question is about how to define value label more easily. Suppose we want to define a value label just corresponding to the recode rule, then we must write the same rule text in double quotes ( "" ). If there are a lot of recode rules, this work will be tedious. So, is there any way to get rid of that? That is to say, remove texts in double quotes ("1/10", for example) in the following codes, but attain the same outcomes.
Code:
recode varname (0=0 "0") (1/10=1 "1/10") (11/20=2 "11/20") (21/30=3 "21/30") (31/40=4 "31/40") (41/50=5 "41/50") (51/60=6 "51/60") (61/70=7 "61/70") (71/110=8 "71/110"), gen(newvar)
Comment