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]

st: Continuing a loop inspite of errors

From   "Narahari H.S." <>
To   statalist <>
Subject   st: Continuing a loop inspite of errors
Date   Wed, 25 May 2011 12:26:55 +0530 (IST)

Hello all,

I have to run a loop on a set of variables which are named like xxx10, xxx11,xxx13,xxx17.....xxx90. There is no set pattern in the number suffix of the variable name but the minimum suffix is 10 and max is 90.

I cant use -forvalues- as the suffixes are not continuous and they do not have a fixed difference. One way to do it is to use -foreach- but I have to manually enter all the variable names and thats quite cumbersome.

I could use -forvalues- if there was a command to continue the loop inspite of an error i.e. if I use -forvalues i=10(1)90{- , the looping is stopped when i is set to 12 as xxx12 is not present. 

Could you please tell me if theres a command for continuing the loop inspite of errors or any other technique to do this?

Thanks in advace

*   For searches and help try:

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