Statalist


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

Re: st: variables into a macro


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: variables into a macro
Date   Sat, 3 Nov 2007 12:28:37 -0400

In addition to
unab v: _all
di "`v'"
ds
di r(varlist)

another way is available via -syntax- e.g.

sysuse auto, clear
syntax [varlist]
di "`varlist'"

which is a handy trick in a do-file in addition to being invaluable in
-program-s since you can supply a varlist to your do-file, or (by
default) let it operate on all variables.

On 11/3/07, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- Philipp Rehm <philipp.rehm@gmx.de> wrote:
> > ds _all
> > di "`r(varlist)'"
> >
> > But you may want to select variables into a macro, based on the
> > patterns of their name (or other characteristics). Again, -ds- is
> > very helpful here.
>
> An extended version is -ds3- by Nick Cox downloadable from -ssc-
>
> --Maarten
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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