*! version 1.0.01 29aug2015
help ms_fvstrip

Title

ms_fvstrip -- Stata utility for removing b/n/o factor variable operators from varlists

Syntax

ms_fvstrip
(varlist)
[if exp]
[, dropomit expand onebyone NOIsily ]

options

expand
expand varlist using fvexpand if not already expanded

onebyone
when used with expand, expands varlist by calling fvexpand
on each variable in varlist separately instead on the entire varlist at once

dropomit
drop any omitted variables, including factor variable base categories, from the returned varlist

noisily
display stripped varlist

Saved results

ms_fvstrip saves the following in r():

Macros

r(varlist) stripped varlist

Description

ms_fvstrip is a utility for removing the b/n/o factor variable operators from a varlist.
With the expand option, it will expand the varlist if not already expanded.

ms_fvstrip is intended for use by Stata programmers,
who may freely include it in their ado programs
and/or modify it as they wish for their own uses.

Examples

. sysuse auto

Typical use in a program:

. fvexpand i.rep78

. ms_fvstrip `r(varlist)'

Or:

. fvexpand i.rep78

. ms_fvstrip `r(varlist)', dropomit

Illustrative examples:

. fvexpand i.rep78

. global vlist `r(varlist)'

. `"di "$vlist""'

. ms_fvstrip $vlist

. return list

. ms_fvstrip i.rep78, expand noi

. ms_fvstrip i.rep78 if rep78~=3, expand noi

. ms_fvstrip i.rep78, expand dropomit noi

. fvexpand i.rep78#i.foreign

. `"di "`r(varlist)'""'

. ms_fvstrip `r(varlist)', dropomit noi

expand option means an internal call to fvexpand so order changes:

. ms_fvstrip 2.rep78 1.rep78, noi

. ms_fvstrip 2.rep78 1.rep78, noi expand

Fails because i.foreign is unexpanded:

. ms_fvstrip i.foreign 2.rep78 1.rep78, noi

Fails because of base category conflict in internal fvexpand call:

. ms_fvstrip i.foreign 2b.rep78 1b.rep78, noi expand

Works:

. ms_fvstrip i.foreign 2.rep78 1.rep78, noi expand onebyone

Author

Mark E Schaffer, Heriot-Watt University, UK
m.e.schaffer@hw.ac.uk

Also see

Help: fvvarlist; fvexpand; varlist