Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • "replace" command changes the variable tags.

    Greetings, Statalists!

    I'm currently using Stata to analyze data on Political Culture in Colombia. In the survey I'm using, a variable called "P6020" contains information about the subjects' gender. Male=1, Female=2. When I use the following lines, the values change just fine, but the tags of the categories (Male and Female) change as well:
    Code:
    *Tags are 1 for Male, 2 for Female
    *Replacing values corresponding to male subjects from 1 to 0:
    replace P6020=0 if P6020==1
    *Replace values corresponding to female subjects from 2 to 1:
    replace P6020=1 if P6020==2
    *The tags have changed to 0 (0) and Male (1)
    I'll show you:
    Click image for larger version

Name:	StatalistEvidence.PNG
Views:	1
Size:	12.3 KB
ID:	1539539


    Please tell me if you know how to fix it or preventing it from happening. Thanks in advance!

  • #2
    Well, of course they have changed in that way. I suspect you are unfamiliar with how those "tags" (in Stata they are called value labels) work in Stata, because you wouldn't expect anything other than what you see here if you were. Read -help label-, and also the section of the [D] manual that is linked to that help file near the top to learn how value labels work in Stata. Then you will know how to modify the value label so that 0 will be labeled Male and 1 will be labeled female.

    Comment


    • #3
      Read -help label-, and also the section of the [D] manual that is linked to that help file near the top to learn how value labels work in Stata.
      Thank you very much! I just started learning how Stata works.

      Comment

      Working...
      X