Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Factor variables and outreg/outreg2

From   Richard Williams <>
To, "" <>
Subject   Re: st: Factor variables and outreg/outreg2
Date   Fri, 02 Mar 2012 16:25:41 -0500

At 03:49 PM 3/2/2012, Schmidt, William wrote:
I am attempting to use outreg2 but I would like to report a limited set of covariates. I have factor variables in my regression, and they seem to be ignored by the options in outreg. In the example below, for instance, i.foreign##c.weight is not reported.

sysuse auto, clear
regress mpg i.foreign##c.weight i.rep78 headroom
outreg2 using myfile, keep(i.foreign##c.weight headroom) sortvar(headroom i.foreign##c.weight)

This isn't quite right but it may be closer to what you want.

outreg2 using myfile, keep(1.foreign#c.weight headroom) sortvar(headroom i.foreign#c.weight)

Personally, I tend to avoid the ## notation and instead write stuff like

regress mpg i.foreign weight i.foreign#c.weight i.rep78 headroom

It may take more typing but it helps me to keep straight what I am doing. Plus, in various post-estimation commands, you often have to write things like 1.foreign rather than i.foreign. Look at how the regress command labeled each line of the output.

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index