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.