Announcement

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

  • recode error: invalid name

    Hi there,

    Sorry, but this one is making my head in, specially becuase the code used to run smoothly. My issue is that the recode command seems not to be working correctly, so at some point in my code I have this syntaxis:
    Code:
    ren     sexo female
    lab var female "Indicator variable for the sex of the worker"
    recode     female (0=.) (1=0) (2=1)
    That throws the error '0 invalid name' and there is a value 0 for those missing, I would appreciate it if somebody could let me know what I am doing wrong.

    Kind regards
    Ruben

  • #2
    It does not look like you are doing anything wrong, and I cannot replicate your problem:
    Code:
    . //  CREATE TOY DATA SET TO TEST CODE
    . clear*
    
    . set obs 10
    Number of observations (_N) was 0, now 10.
    
    . gen sexo = runiformint(0, 2)
    
    . 
    . //  TEST CODE
    . ren     sexo female
    
    . lab var female "Indicator variable for the sex of the worker"
    
    . recode     female (0=.) (1=0) (2=1)
    (10 changes made to female)
    Suggestions:

    0. Close Stata, shutdown your computer, reboot it, and try again.
    1. If that does not work, make sure your Stata installation is completely up to date. Run -update all, force-. Then try again.
    2. If that does not work, try uninstalling it, reinstalling it, and updating the reinstallation. Then try again.

    If that does not work, contact Stata Technical Support. Be sure to send them the output of the -about- command describing your setup, as well as an example data set which reproduces this problem, and the problem code itself.

    Good luck!

    Comment

    Working...
    X