Statalist The Stata Listserver

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

Re: st: Looping through a range of variables

From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: Looping through a range of variables
Date   Fri, 17 Nov 2006 10:18:47 -0500

why not:

foreach var of varlist Var1-New7 {


Rachel wrote:

I'd like to loop through a large number of variables that don't have
common prefixes or suffixes.   So I'd like to create a loop that goes
through all variables in a range (e.g. Var1-New7 where the variables
are Var1 Var2 New3 New7.).

"Foreach" requires a list, not a range, so that doesn't work.  And
ForValues obviously only accepts numbers.

Is there a way of doing this?


*   For searches and help try:

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