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

Re: st: local r(varlist)?

From   Martin Weiss <>
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

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

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?

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
CRICOS provider #00120C

*   For searches and help try:

*   For searches and help try:

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