Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: forvalues - irregular step sizes

From   "Danielle H. Ferry" <>
To   StataList <>
Subject   st: forvalues - irregular step sizes
Date   Thu, 20 Feb 2003 10:38:41 -0500


I would like to run the following loop, where I have a series of variables
produced by a regression containing an interaction of state*popnLn*ttrend1.
"popnLn" & "ttrend1" are continuous variables, but "state" is a categorical
variable. Since the coding for "state" has irregular spacings (1, 5, 16, 20,
23, etc.) the loop fails. Is there a way to make it continue onto the next
loop if, for example, a value of i=2 is not found?

forvalues i = 5(1)54{

    test _Ist`i'XpoXtt

    scalar f`i' = r(F)
    scalar pr`i' = r(p)


Any help would be greatly appreciated!

Danielle H. Ferry
National Bureau of Economic Research
365 Fifth Avenue, 5th Floor
New York, NY 10016

*   For searches and help try:

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