Hello Statalist,

I am currently trying to run the following loop:

Code:
forvalues i = 5152/5172 {
        egen tag_`i' = tag(prod_`i’ investorid) if prod_`i’==1
    }
I get the error r(100) - "{ required". I have seen some posts on here where this happened and the problem was that the "if" statement was on a separate line of code - as you can see it is not in my code. When I do this command outside of a loop, it works fine. For example

Code:
egen tag = tag(prod_5152 investorid) if prod_5152==1
This works, but putting it into loop form is causing that error. Any suggestions?

Thanks,
Andy