-selectvars- is a program on SSC. (Reminder: You are asked to make
clear where user-written stuff you refer to comes from.)
I located -selectvars- and found the following within its help.
In short, -selectvars- is stated to save results in
r(varlist) and an example is given of how you may use its saved results.
An alternative for similar problems is -tuples- from SSC.
------------------------------------------------------------------------
----------------------------------------
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.
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
[email protected]
I think that -selectvars- will be useful in my current program, but, as
a beginner, could not understand how the results are saved.