[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: How to put a prefix on a categorical variable that still carries label values? |

Date |
Thu, 28 Feb 2008 16:08:46 -0000 |

I understand this as follows: Suppose variable -x- has values 11, 12, 13, ... and value labels "A", "B", "C", .... You want -y- to have values 111, 112, 113, ... and the corresponding value labels. Try gen y = 100 + x labmask y, values(x) decode Here -labmask- is in -labutil- on SSC. Nick n.j.cox@durham.ac.uk Jia Xiangping A variable in int storage type, reflecting different regions. label region code value 11 A 12 B 13 C 21 D 22 E 23 F 31 G 32 H Now I want to generate a new variable with a prefix "1" denoting the country code. But the variable still carry the codes. 111 A 112 B 113 C 121 D 122 E 123 F 131 G How shall I do that with -recode-? Or there are some other commands for that? * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: How to put a prefix on a categorical variable that still carries label values?***From:*"Jia Xiangping" <jiajoseph@googlemail.com>

**References**:**st: How to put a prefix on a categorical variable that still carries label values?***From:*"Jia Xiangping" <jiajoseph@googlemail.com>

- Prev by Date:
**Re: st: mvprobit** - Next by Date:
**st: question on cond( )** - Previous by thread:
**st: How to put a prefix on a categorical variable that still carries label values?** - Next by thread:
**Re: st: RE: How to put a prefix on a categorical variable that still carries label values?** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |