I am running the same kind of regressions with small changes, and I feel like I am doing it in an awkward way, like this:
It works, but I am defining a variable varlist (with the same value for perhaps millions of observations), and I specify it as a local in the program. I have tried using local and global outside of the program (instead of, or in addition to specifying the local in the program) and it didn't work. I have read sections of the Stata manual and searched this forum, and although I'm sure there is an example out there that does what I want in a better way, I couldn't find it. I encounter the same problem when instead of defining a program, I call on another .do file; I suppose the solution will be similar. For numerical values I have found that I can use
before calling on the program and just use "number" in the program - is there an equivalent for strings?
Thank you!
Code:
capture program drop example program example { local y = varlist reg x `y' } end capture drop varlist g varlist = "a" example capture drop varlist g varlist = "a b" example
Code:
scalar number = 1
Thank you!
Comment