I'm trying to run a regression with a bunch of interactions. Specifically, I have a macro and one interaction variable, but want the interaction variable to interact with everything in the macro.
So far, what I have looks like
local example "covariate1 covariate2"
reg outcome_var `example' `example'#interaction_var
The problem is that
`example'#interaction_var
only has interaction_var
interacting with one of the covariates in example
, but I want all the covariates interacted with. Is there a way to have an interaction term for every covariate in the macro?
EDIT: I've decided to go an alternate route, since a one-liner may not be possible. Namely, I'm trying to loop over the macro, where for each word in the macro, I interact it with the interaction variable and append it to a new, blank macro. So right now, this looks like
local ints ""
local len_e : word count $example
forval i=1/len_e{
local e `:word `i' of `example''
local ints $ints `e'#`int'
}
but I'm getting an invalid syntax error.