First: as a general practice, when you get no results with -runby-, you should do it again with the -verbose- option specified. That way you will see the error messages generated by the program that -runby- is iterating. Of course, those will be interspersed with a flood of output, but they are usually not that hard to find since they are in red.
In this instance, though I see the mistake. The line -local denom = r(var)- is the problem. There are two things wrong with it.
In this instance, though I see the mistake. The line -local denom = r(var)- is the problem. There are two things wrong with it.
- Presumably your intent is to get the variance of some variable that has just been put through the -summarize- command. But there is non -summarize- command preceding that. The preceding command is instead a -tsset- command. -tsset- returns a lot of tings in -r()- but none of them are variances. And if there were an earlier -summarize- command, whatever it left behind in -r()- would have been overwritten by the -tsset-.
- Even if you did have a -summarize- command immediately before the -local denom = r(var)- command, -summarize- does not leave behind an -r(var)-. It leaves behind -r(Var)-. Everything in Stata is case sensitive. I'm not sure why, of all the things left behind by -summarize-, this one, and only this one, is capitalized, but that's the way it is, and you have to program accordingly.
Comment