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

st: RE: How to get results from -selectvars-

From   "Nick Cox" <>
To   <>
Subject   st: RE: How to get results from -selectvars-
Date   Wed, 14 Nov 2007 23:02:30 -0000

-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(#) ]


    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.


    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.


    . 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

I think that -selectvars- will be useful in my current program, but, as
a beginner, could not understand how the results are saved.

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