Dear all,
I am running a loop for panel data. Their aim is to obtain some kind of optimal value from a regression of var1 on var2. I am having about 80 countries in the sample and when I run the loop on the first country I get the error
I switched, but not desired, variable "country" with the panel identifier "ID" and got
I've run the code by substituting my two variables with two others and got again the
error
Thank you
Here is my code below. Can you please tell why and where I am wrong?
levelsof id, local(con)
levelsof year, local(time)
foreach i of local con{
foreach j of local time{
regress var1 c.ivar2##c.var2 if id == `i' and year ==`j'
generate optiVar3`i'`j' = -_b[var2]/(2*_b[var2 #ivar2 ])
generate optvar4`i'`j' = _b[var2 ]*var2 + ... ...
}
}
Giorgio!
I am running a loop for panel data. Their aim is to obtain some kind of optimal value from a regression of var1 on var2. I am having about 80 countries in the sample and when I run the loop on the first country I get the error
"country_name" not found
Code:
invalid 'and'
Code:
invalid 'and'
Thank you
Here is my code below. Can you please tell why and where I am wrong?
levelsof id, local(con)
levelsof year, local(time)
foreach i of local con{
foreach j of local time{
regress var1 c.ivar2##c.var2 if id == `i' and year ==`j'
generate optiVar3`i'`j' = -_b[var2]/(2*_b[var2 #ivar2 ])
generate optvar4`i'`j' = _b[var2 ]*var2 + ... ...
}
}
Giorgio!
Comment