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
loans/portfolio/partnersHi all, I have data that looks like the following Loan_ID Loan_date Lender_ID Lead_lender Borrow…
Plot graphs in multiple windowsHey, I have some accounting data for companies, matched into 58 industry codes. I want to plot grap…
Already defined variable in a loopHello. I am trying to generate confidence interval for some regressed variables. This is the code: …
Panel data - xtline scaling issueHello, I am running a fixed effects regression for my panel data (xtset regions year). I have 10 reg…
Random Sample of two main groups consisting 5 subgroupsHi, I would like to select random sample from my data set on following conditions Two sites site A=…
Subscribe to:
Post Comments (Atom)
0 Response to macro as program argument
Post a Comment