Statalist


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

Re: st: local r(varlist)?


From   Martin Weiss <[email protected]>
To   [email protected]
Subject   Re: st: local r(varlist)?
Date   Sat, 14 Jun 2008 17:05:19 +0200

See -h foreach- to note that you must say -in- with -anything-


**************************
sysuse auto, clear

ds
ret li


foreach v of any `r(varlist)' {

	di "`: var l `v''"
}

loc r="`r(varlist)'"

di "`r'"


foreach v in `r'  {

	di "`: var l `v''"
}



Zitat von Keith Dear <[email protected]>:

This is a small point I am puzzled by, but in the interests of knowing
how Stata thinks:

Following -ds- (and I guess many other commands),

this works:
. foreach v of any `r(varlist)' {
(so r(varlist) is behaving like a local macro)

but this doesn't:
. foreach v of local r(varlist) {
(error message: "{ required")

what am I misunderstanding here?
kd

Dr Keith B.G. Dear
Senior Fellow in Biostatistics
National Centre for Epidemiology and Population Health
Australian National University
Canberra, ACT 0200, Australia
Tel: 02 612 54865, Fax: 02 612 50740
http://nceph.anu.edu.au/Staff_Students/staff_pages/dear.php
CRICOS provider #00120C

http://canberragliding.org/

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



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