Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: expanding a local that contains a list or wildcards


From   Gary Longton <glongton@fhcrc.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: expanding a local that contains a list or wildcards
Date   Tue, 05 Aug 2003 11:04:53 -0700

Dimitriy V. Masterov wrote:

I am having the following problem. I have a program that uses a local
rhsvars that looks like  "x1 x2 x3 x4 x5". I would like to be able
to use a shortcut and write it as "x1-x5" or as "x*". However, this runs
into the problem that when I tokenize this local later on in the
program, it does not create locals 1-5 containing x1 through x5, just a
local named 1 that contains the text "x1-x5". Is there a way to expand
rhsvars from its abbreviated form and redefine so that the tokenize
command works?
-unab- (unabbreviate a variable list) should do what you want.

Eg.

unab vlist : x1-x5
tokenize `vlist'

will unabbreviate the abbreviated varlist x1-x5 (or x*) and place it in the local macro `vlist'

see help for -unab- or [P] unab

- Gary


*
* 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