Dear Statalist,
I use factor variables in a standard regression (i.varname). I wish to only keep a few variables in my output table using outreg, but I cannot find a way to refer to factor variables in the keep/drop option.
Example of what I am trying to accomplish:
That is, there are dummies for each age and year category, which I don't want to get into my output table. Cost is a continuous variable that I interact with a dummy variable eligibility. I have tried keep(cost 1.eligibility), keep(c.cost##eligibility) etc. modifications, without luck. With just "eligibility" in the keep option, the error message is "eligibility not found in estimates, or repeated". With "1.eligibility" the error message says "factor variables not allowed", with "i.eligibility" it says "1: operator invalid". With standard postregression command you can use the 1.varname type to refer to factor variables but apparently not outreg.
A way out is of course to create a new variable (generate cost_elig=cost*eligibility) and include that in the regression, with keep(cost eligbility cost_elig) in outreg, but I like the flexibility of factor variable and interaction notation, that I don't have to generate new variabels as I go.
I found an earlier thread from a couple years ago on the same topic but the issue remained unresolved.
Any ideas? Or, does outreg simply not support factor variables?
Best,
Tuuli
I use factor variables in a standard regression (i.varname). I wish to only keep a few variables in my output table using outreg, but I cannot find a way to refer to factor variables in the keep/drop option.
Example of what I am trying to accomplish:
Code:
regress outcome c.cost##eligibility i.age i.year outreg, keep(cost eligibility) *or alternatively: outreg, drop(i.age i.year)
A way out is of course to create a new variable (generate cost_elig=cost*eligibility) and include that in the regression, with keep(cost eligbility cost_elig) in outreg, but I like the flexibility of factor variable and interaction notation, that I don't have to generate new variabels as I go.
I found an earlier thread from a couple years ago on the same topic but the issue remained unresolved.
Any ideas? Or, does outreg simply not support factor variables?
Best,
Tuuli

Comment