Stata 15 help for _ms_extract_varlist

Title

[P] _ms_extract_varlist -- Match variables from e(b)

Syntax

_ms_extract_varlist [varlist] [, matrix(name) row equation(eqid) noomitted nofatal]

Description

_ms_extract_varlist returns the expanded, specific varlist from e(b) that matches varlist.

Options

matrix(name) specifies that _ms_extract_varlist use information from the column stripe associated with the named matrix. The default matrix is e(b).

row specifies that the information come from the row stripe. The default is the column stripe.

equation(eqid) specifies that varlist is in equation eqid. The default is the first equation.

noomitted specifies that omitted varlist is ignored. The default is to match omitted variables. Omitted variables include variables dropped because of collinearity, as well as base levels of factor variables and interactions.

nofatal specifies that _ms_extract_varlist ignore variables in varlist that are not found in the column stripe for e(b). The default is to exit with an error.

Remarks

Using auto.dta, say that you have run a regress of mpg on i.foreign and i.rep78:

. regress mpg i.foreign i.rep78 (output omitted)

The corresponding specific, expanded varlist is i0b.foreign i1.foreign i1b.rep78 i2.rep78 i3.rep78 i4.rep78 i5.rep78. It can be found on the column stripe of e(b),

. mat list e(b) (output omitted)

If you now coded _ms_extract_varlist i.foreign, returned in r(varlist) would be 0.foreign 1.foreign. This would be useful, for instance, if you were programming ancillary statistics after estimation and, in the command you are writing, the user specified the variables of interest. Thus your command might read

program mycmd version 15.1 syntax varlist(fv) ... ... _ms_extract_varlist `varlist' local vars_to_use `r(varlist)' ... foreach el of local vars_to_use { ... } ... end

Stored results

_ms_extract_varlist stores the following in r():

Macros r(varlist) the matched expanded, specific varlist


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