Statalist


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

st: Re:Obtaining varlist from other dataset


From   "P. Wilner Jeanty" <[email protected]>
To   [email protected]
Subject   st: Re:Obtaining varlist from other dataset
Date   Sat, 2 Feb 2008 01:36:34 -0500

On Feb 2, 2008 12:57 AM, Keith Dear <[email protected]> wrote:
> David,
> Wilner is right, the varlist option does solve your problem. But the statement:
> . local myvars r(varlist)
> merely assigns the string "r(varlist)" to the macro, which therefore
> contains only one word.
> You can verify this with
> . display "`myvars'"
> r(varlist)
>
> You can get what you need like this:
> . describe using my_file, varlist
> . local myvars=r(varlist)       // "=" inserted
> . display "`myvars'"
> x1 x2 x3 x4
>
> The "=" has the effect of *evaluating* r(varlist), and assigning the
> result to myvars.
> Keith

David's problem is indeed solved. Not only can he put all the
variables in a macro, he can also put them in separate macros. As
Keith clarified, the "=" sign solved the problem of extended macro
function manipulation.
-- 
P. Wilner Jeanty, Post-doctoral researcher
Dept. of Agricultural, Environmental, and Development Economics
The Ohio State University
2120 Fyffe Road
Columbus, Ohio 43210
(614) 292-6382 (Office)
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index