Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: -nestreg- (was: st: saving a sample after a regression)

From   "Michael S. Hanson" <>
Subject   Re: -nestreg- (was: st: saving a sample after a regression)
Date   Mon, 12 Mar 2007 18:02:30 -0500

On Mar 12, 2007, at 4:40 PM, Jeff Pitblado, StataCorp LP wrote:

Michael S. Hanson <> expressed an interested in getting -nestreg- to support a command:

The on-line help also makes reference to using -sw- or -swml- as -program- properties for the user-written program.... But neither the on-line help nor the manuals have turned up any information on such properties (although I concede I may have missed them).
Program properties are documented in -[P] program properties-, which is also present in the online help. In Stata type

. help program properties
Thanks, Jeff. I guessed I had probably missed them; next time I'll look with -hsearch- instead of just using the "Find" command from the OS with a particular help file. Trying -hsearch sw- now shows -program_properties- as the top hit.

Note that the paretheses in -ivreg-'s varlist syntax are in conflict with the standard syntax required by -nestreg-. Here is a simple wrap-around routine for -ivreg- that allows you to fix the instrumental variables when it is prefixed with -nestreg-:

program myivreg, prop(sw)
version 9.2
syntax [varlist] [if] [in] [aw fw iw pw] [, ivlist(string) *]
ivreg `varlist' (`ivlist') ///
`if' `in' [`weight'`exp'], `options'

In -myivreg-, all we really did was provide the standard syntax and the -sw- program property; -ivreg- handles all the other things like -e(b)-, -e(V)-, and -e(sample)-.
Thanks also for that example -- it gives me something to experiment with.

-- Mike

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index