I would like to run the following 4 sequential models. I would like to create interactions on the fly. How can I include i.var and tell the local macro to pass them to xtreg?
local mod1 = "OTC i.event_date_my"
local mod2 = "`mod1' state_ab#c.event_date_my" // adds state-specific linear time trends
local mod3 = "`mod2' state_ab#(c.event_date_my#c.event_date_my)" // adds quadratic state-specific time trends, and
local mod4 = "`mod3' cov_food_st_person cov_unemp_rate" // the final column adds covariates.
local models "`mod1'" "`mod2'" "`mod3'" "`mod4'"
#delimit ;
foreach dv of local dvs
{;
foreach mod of local models
{;
eststo: quie xtreg `dv' `mod', fe vce(cluster state_ab);
estadd ysumm , mean ; // return only mean
display `dv';
};
};
#delimit cr
---> Stata is complaining at me by throwing this error message: invalid 'i.event_date_my'
Any suggestions? Thank you.
Related Posts with How do include virtual factor variables (created with i. or c. operators) in local macros to use them in for loops?
Is a ordered logit model possible?First of all, thank you for reading. I have a question. As a dependent variable, we use the average…
Saving tabstat as a matrix and calculate j-b valueDear statalist: I am learning to obtain descriptive statistics of variables, but i don't know how t…
Help with destringing a variableHello, I'm working with a dataset and I want to destring a variable. This variable is a string but w…
multipl regression with an unstructured datahello. What are the keywords to find literature related to the following? "The basic theory of inf…
export multiple regression results.Hello to all, I'm creating this topic because I haven't found my answer on it. I am currently stuc…
Subscribe to:
Post Comments (Atom)
0 Response to How do include virtual factor variables (created with i. or c. operators) in local macros to use them in for loops?
Post a Comment