Announcement

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

  • Invalid Syntax while looping

    hello, i dont know why stata keeps me showing invalid syntax in this loop:

    foreach x of p524a1_14 p524a1_15 p524a1_16 p524a1_17 p524a1_18{
    summ `x'
    gen ING_`x' = (`x'-r(mean))/r(sd)
    }

    i tried with an space just before the "{" and every way but i cant do it
    please send your suggestion
    thank you so much

  • #2
    Try replace the "of" in the first line with "in".

    Comment


    • #3
      Ken Chui is right as usual.

      See the help for foreach

      of is a keyword and must always be followed by another acceptable keyword, in this case varlist or an acceptable abbreviation thereof.

      Comment


      • #4
        Thank you Ken and Nick.

        Comment

        Working...
        X