Dear, Statalisters -
I've attached a do-file that I hope clarifies this question, using one of the sysuse datasets. Following forum rules, I will try to be as specific as possible:
What I've been doing (see lines 22-44 of attached do-file):
- Typically, when I run a large number of regressions, I specify a varlist local and will look the appropriate regressions based on the levels of those variable.
E.g., For binary y variables, I write a local and will loop logistic regressions, and for unordered categorical y variables will run mlogit, and for continuous variables, I will run regress
What I'd like to do (see the half-baked attempts and notes):
- Rather than specify each kind of variable manually, I want to create locals for varlists of binary (2 levels, e.g. male/female), categorical (3/6 levels), and continuous (e.g. > 10 levels).
- From these locals I want to then run the appropriate regression model based on the functional form of the y variable.
My intuition (again see lines 44+ of attached do-file):
- use the "ds" command or "cond()" function to specify locals; I looked for this in StataList and could not find an example.
Main motivation:
- I'm working on a large, collaborative project, with limited resources, a short timeline, and I need flexible syntax because I *know* we will chage our dependent variables. I want modular syntax to save us money (and me time)
- Project specifics: The data are confidentical, so I cannot share them, so the do-file includes one of the built-in Stata datasets. Details, however: I'm looking at perhaps 100 outcomes, perhaps more (we are trying to produce different groups of analysis). Obviously, the above strategy of automating the forms of each outcome variable is not perfect, but will help us in expediting exploratory data analysis; the specifications I identified for outcome variables meet 99% of our variables.
Thanks much!!
- Nate
I've attached a do-file that I hope clarifies this question, using one of the sysuse datasets. Following forum rules, I will try to be as specific as possible:
What I've been doing (see lines 22-44 of attached do-file):
- Typically, when I run a large number of regressions, I specify a varlist local and will look the appropriate regressions based on the levels of those variable.
E.g., For binary y variables, I write a local and will loop logistic regressions, and for unordered categorical y variables will run mlogit, and for continuous variables, I will run regress
What I'd like to do (see the half-baked attempts and notes):
- Rather than specify each kind of variable manually, I want to create locals for varlists of binary (2 levels, e.g. male/female), categorical (3/6 levels), and continuous (e.g. > 10 levels).
- From these locals I want to then run the appropriate regression model based on the functional form of the y variable.
My intuition (again see lines 44+ of attached do-file):
- use the "ds" command or "cond()" function to specify locals; I looked for this in StataList and could not find an example.
Main motivation:
- I'm working on a large, collaborative project, with limited resources, a short timeline, and I need flexible syntax because I *know* we will chage our dependent variables. I want modular syntax to save us money (and me time)
- Project specifics: The data are confidentical, so I cannot share them, so the do-file includes one of the built-in Stata datasets. Details, however: I'm looking at perhaps 100 outcomes, perhaps more (we are trying to produce different groups of analysis). Obviously, the above strategy of automating the forms of each outcome variable is not perfect, but will help us in expediting exploratory data analysis; the specifications I identified for outcome variables meet 99% of our variables.
Thanks much!!
- Nate
Comment