Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Defining upper limit of loop

From   "Thomas, Anthony" <>
Subject   Re: st: Defining upper limit of loop
Date   Wed, 11 Dec 2013 17:18:27 -0500

Stata probably will not let you do that. Variable names cannot be a
number, and "forval" type loops expect a numeric range (i.e. "variable
name" would have to be a number). If you want to use variables in a
loop, consider using:

foreach i of varlist "varlist"{




On Wed, Dec 11, 2013 at 5:08 PM, Nabin Kafle <> wrote:
> Is there a way that I can use the forvalues command in stata in a way
> that I upper value of the loop can be defined from the varibale list.
> forvalues i = 1/"var name" {
> code for loop
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index