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" <dferry@nber.org>
To   StataList <statalist@hsphsun2.harvard.edu>
Subject   st: forvalues - irregular step sizes
Date   Thu, 20 Feb 2003 10:38:41 -0500

Hi,

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:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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