[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Mike Lacy <Michael.Lacy@colostate.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Keep value labels after -mvdecode- |

Date |
Wed, 28 Oct 2009 12:29:28 -0600 |

Elan Cohen: wrote:

maritalstatus 0 9 ethnicity 0 99

prog rectomiss // handles the recode for one variable args varname v1 v2 v3 v4 v5 //clumsy I know local misslist = ".a .b .c .d .e" // five should be enough tokenize `misslist' local i = 1 foreach val of numlist `v1' `v2' `v3' `v4' `v5' { local misscode = ``i'' recode `varname' (`val' = `misscode') local ++i local labelname: value label `varname' if "`labelname'" != "" { //blank local lblstrg: label(`varname') `val' label define `labelname' `misscode' "`lblstrg'", add label values `varname' `labelname' } } // sample usage // rectomiss ethnicity 0 99 // rectomiss maritalstatus 0 99

=-=-=-=-=-=-=-=-=-=-=-=-= Mike Lacy Fort Collins CO USA (970) 491-6721 office * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**RE: st: Keep value labels after -mvdecode-***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**RE: st: Keep value labels after -mvdecode-***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**st: RE: The varimax rotation** - Next by Date:
**st: Re: Backed up message stata list** - Previous by thread:
**st: RE: Keep value labels after -mvdecode-** - Next by thread:
**RE: st: Keep value labels after -mvdecode-** - Index(es):

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