Announcement

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

  • Invalid Syntax r198

    Hi everyone,

    I'm having issues with a couple of my recoding commands and wonder if you could help.

    I need to recode categorical variables, and have managed to successfully recode one of them, but the next ones have both had the same invalid syntax r198 error, but I cant figure out why.

    I have attached a picture of my commands, the first one works, and the second two both come up with invalid syntax.


    Click image for larger version

Name:	stata help.png
Views:	1
Size:	51.4 KB
ID:	1703469


    Thanks so much for any help!
    Daisy

  • #2
    Please use CODE delimiters for syntax examples, not an image. That doesn't bite here, but it is better general practice.

    The problem in each case is that the names of value labels may not include spaces.

    In Stata no names may include spaces.


    There are other rules about what can be a name, but replacing spaces with underscores should work here as each label would then be 23 characters long, which is less than the maximum allowed.


    Code:
    . di length("highest_education_level")
    23
    
    . di length("German_speaking_ability")
    23
    See for example [U] 11.3 Naming conventions in the PDF documentation.

    Comment

    Working...
    X