Announcement

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

  • Label Define - syntax error

    I recently created a new variable, RELTRAD2, and then tried to create a set of labels for the values of the new variable. The program (Stata 14 on a PC) gives me a syntax error. I can't see an obvious problem but it's been awhile since I've used Stata. To be clear, I called the values "rtlab2". Here's the output:

    -> tabulation of RELTRAD2

    RELTRAD2 | Freq. Percent Cum.
    ------------+-----------------------------------
    1 | 296 7.96 7.96
    2 | 207 5.57 13.53
    3 | 744 20.01 33.53
    4 | 406 10.92 44.45
    5 | 512 13.77 58.21
    6 | 729 19.60 77.82
    7 | 772 20.76 98.57
    99 | 53 1.43 100.00
    ------------+-----------------------------------
    Total | 3,719 100.00

    . label define rt2lab 1 “All Jews” 2 “Mormon” 3 “Mainline Prod” 4 “Black Prod” 5 “White Catholic” 6 “Hispanic Catholic” 7 “White Evangelical” , add
    invalid syntax

    Could anyone let me know if they understand the error? I'd be grateful.

    Ken Wald


  • #2
    I cannot replicate your error:

    Code:
    . label define rt2lab 1 "All Jews" 2 "Mormon" 3 "Mainline Prod" 4 "Black Prod" 5 "White Catholic" 6 "Hispanic Catholic" 7 "White Evangelical" , add
    
    . label li
    rt2lab:
               1 All Jews
               2 Mormon
               3 Mainline Prod
               4 Black Prod
               5 White Catholic
               6 Hispanic Catholic
               7 White Evangelical
    Did you copy and paste the code which resulted in that error exactly?

    Comment


    • #3
      You need the plain

      Code:
      character as string delimiter, note curly double quotes,

      Comment

      Working...
      X