-------------------------------------------------------------------------------
help for selectvars
-------------------------------------------------------------------------------

Selecting all possible n-tuples from a varlist

selectvars varlist [, min(#) max(#) ]

Description

selectvars produces a list of all possible n-tuples from a list of variable names. That is, given a list of k variable names, it produces the empty list; all possible distinct singletons (each individual variable name); all possible distinct pairs; and so forth. Tuples are bound in " ". As selectvars is intended for programming, the list is not displayed, but left behind as a saved result.

Note that there is no checking of a possible error with even modest k: that a full list of (at most 2^k) tuples can not be accommodated in a macro.

As of January 2011, this command is declared superseded by the author's tuples.

Options

min(#) specifies a minimum value for the number of names in a tuple.

max(#) specifies a maximum value for the number of names in a tuple.

Examples

. selectvars headroom trunk length displacement

. foreach v in `r(varlist)' { . regress mpg `v' . } . selectvars headroom trunk length displacement, min(2) max(2)

Saved results

r(varlist) list of tuples

Author

Nicholas J. Cox, University of Durham n.j.cox@durham.ac.uk

Acknowledgments

Sebastian Orbe reported a problem in tuples which led to a bug fix.