Dear Stata Users,
I have a series of command "sets" in a do file, and want to "call" each set within a later command in that do file. What is the best way to handle this?
Here is the basic structure of the problem (all in a single do file at this point):
* First Set
keep if varname1 == 2
local regvars "RegVarName1"
local logitvars "LogitVarName1 LogitVarName2"
local mlogitvars ""
* Second Set
keep if varname2 == 4
local regvars "RegVarName2"
local logitvars "LogitVarName3"
local mlogitvars "MLogitVarName1"
[....lots and lots of sets...]
use mydata
[ run syntax in "First Set" here]
[ do lots of stuff with the local macros defined by First Set ]
And then I want to cycle back to "use mydata", run the syntax in "Second Set", etc. until all sets have been used.
I have tried working with ado files and macros for each syntax set, but no luck so far. I am probably overlooking an easy solution.
Thanks for any help you can offer.
--David
Comment