Good morning everyone,
I have an issue concerning a program which goal is to run an OLS. I name that program "OLS". I have several arguments in that program, including one name "covariates". When calling program "OLS", I would like to give as "covariates", a local macro called X, containing a list of variables. It does not work. Only the first covariate of the list in the macro is used. And it is clearly the problem: once I change "covariates" in the call by "var1 var2 etc...", i.e without using the local macro X, it works (everything is used). Someone could help me ? I doubt that it is impossible to do such a thing. Thank you in advance. Code below.
###
capture program drop OLS
program OLS
args model_name sample treatment group outcome covariates reweight
eststo `model_name': quietly regress `outcome' `treatment' `covariates' if (`sample'==1 & `group'==1) [aw=weight*`reweight'], vce(robust)
end
###
###Call1###
local X "var1 var2 var3"
OLS model_name sample treatment group outcome `X' reweight
###
--> Only takes var1 in X
But here :
###Call1###
OLS model_name sample treatment group outcome "var1 var2 var3" reweight
###
It takes everything of course.
Related Posts with macro as program argument
Trivial question: what does f. stand for?Sorry if this is obvious, but I cannot find an answer As an example gen treatment=0 if (expectatio…
Ordered Logit RegressionDear Statalisters, I have a quick question regarding ordered logits. I have a panel dataset with i…
Running a regression and variables are omitted due to collinearity but i don't know whyHi i was wondering if anyone could help me I am running the following tobit regression: Code: to…
How to Esttab SHOWING THE FIRST STAGE ONLY (Without Showing the Second Stage) with ivreg2?Hi! My question is how to use Esttab to show the first stage WITHOUT Showing the Second Stage with i…
Interpretation of the interaction terms of two categorical variables in Non Linear modelsHi, I have been searching online but cant find much. I need help in understanding the interpretatio…
Subscribe to:
Post Comments (Atom)
0 Response to macro as program argument
Post a Comment