Announcement

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

  • Label variable over multiple lines

    I want to label multiple variables in my dataset in one command, like below:

    lab var ///
    id "ID" ///
    y_school "years of schooling" ///
    occ "occupation" ///
    ... ///
    race "race"

    Stata, however, produces an error message (invalid syntax r(198)

    Any suggestions on correcting this is much appreciated.

  • #2
    You can only define one variable label at a time. The syntax is given in the help:

    Code:
    label variable varname ["label"]
    So you need

    Code:
    lab var id "ID" 
    lab var y_school "years of schooling" 
    label var occ "occupation" 
    label var race "race"
    What you want is programmable and daniel klein may have done it, but the syntax you want isn't legal for label.

    Comment


    • #3
      Originally posted by Nick Cox View Post
      What you want is programmable and daniel klein may have done it, but the syntax you want isn't legal for label.
      I did. elabel (SSC) supports the syntax in #1. Just replace

      Code:
      lab var ...
      with

      Code:
      elabel var ...
      Best
      Daniel

      Comment


      • #4
        Thank you Nick and Daniel. elabel works!!

        Comment

        Working...
        X