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

From |
"Alexandra de Montrichard" <ademontr@comcast.net> |

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

Subject |
st: RE: RE: Label problem |

Date |
Wed, 5 Oct 2005 18:01:47 -0400 |

Nick - Sorry. Let me try to give more information: Here is what I'm trying to do: I have variables (q143-q152) with values 1 to 4 with the labels 1 strongly agree 2 agree somewhat 3 disagree 4 strongly disagree 98 don't know 99 refused I want to create new variables (q143r-152r)in which values 98 and 99 are recoded as . and values 1 to 4 are in reverse order and the new labels are: 1 "strongly disagree" 2 "disagree" 3"agree somewhat" 4"strongly agree" Here is what I've done: 1) I defined labels: label define agreesc 1 "strongly disagree" 2 "disagree" 3"agree somewhat" 4"strongly agree" 2) I then recode the old variable into new variables and added the label agreesc to the new variables (the text below is all on one line in my code): recode q143 q144 q145 q146 q147 q149 q150 q151 q152 (1=4) (2=3) (3=2) (4=1), gen(q143r q144r q145r q146r q147r q149r q150r q151r q152r) label (agreesc) 3) I compared my old & new variable and found that the new variables did not have value labels: . tab q143 q143r q143. in this | organization, it | RECODE of q143 (q143. in this organization, is more important | it is more important to get inpu) to get inpu | 1 2 3 4 | Total ------------------+--------------------------------------------+-------- -- strongly agree | 0 0 0 125 | 125 agree somewhat | 0 0 124 0 | 124 disagree | 0 86 0 0 | 86 strongly disagree | 29 0 0 0 | 29 ------------------+--------------------------------------------+-------- -- Total | 29 86 124 125 | 364 4) If I manually add the labels & run the same table I get the result I was looking for. However, I don't understand why step 2 above did not do add the value labels for variables q143r to q152r. . label values q143r agreesc . tab q143 q143r q143. in this | organization, it | RECODE of q143 (q143. in this organization, is more important | it is more important to get inpu) to get inpu | strongly disagree agree som strongly | Total ------------------+--------------------------------------------+-------- -- strongly agree | 0 0 0 125 | 125 agree somewhat | 0 0 124 0 | 124 disagree | 0 86 0 0 | 86 strongly disagree | 29 0 0 0 | 29 ------------------+--------------------------------------------+-------- -- Total | 29 86 124 125 | 364 Any advise you can provide would be greatly appreciated. Alexandra -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: Wednesday, October 05, 2005 5:22 PM To: statalist@hsphsun2.harvard.edu Subject: st: RE: Label problem As Michael Blasnik said in a recent thread It's not very helpful to say "but it doesn't work" -- if you want help you should say why it doesn't work -- did Stata give you an error? Were the results not what you expected? Nick n.j.cox@durham.ac.uk Alexandra de Montrichard > I'm trying to attach labels as part of a recode but although > it looks to > me as if I have the same code as in one of the stata help examples it > doesn't work. > > recode q143 q144 q145 q146 q147 q149 q150 q151 q152 (1=4) (2=3) (3=2) > (4=1), gen(q143r q144r q145r q146r q147r q149r q150r q151r q152r) > label(agreesc) > > The regular label assignment syntax works fine: label values q143r > agreesc > > Any pointers as to what the problem might be would be greatly > appreciated. * * 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/ * * 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**:**st: Re: RE: RE: Label problem***From:*"Michael Blasnik" <michael.blasnik@verizon.net>

**References**:**st: RE: Label problem***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: Label problem** - Next by Date:
**st: RE: RE: RE: Label problem** - Previous by thread:
**st: RE: Label problem** - Next by thread:
**st: Re: RE: RE: Label problem** - Index(es):

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