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

st: Two "forvalues" loops working together


From   [email protected]
To   [email protected]
Subject   st: Two "forvalues" loops working together
Date   Fri, 14 May 2004 09:47:14 +0200

Dear Stata-listers,

I wish to make two "forvalues" loops work together rather than nested as
shown by my suggested code below.  Is there a way I can do that in STATA 


local samp=_N+43
set obs `samp'
foreach M of newlist prob exp { 
	gen `M'=. 
}
intreg ptiming timing if ~npointer1, noskip intreg
forvalues Y = 120(10)530 ;  X = 43(-1)1 {
		predict prob`Y', pr0(`Y',`Y+10')
		predict exp`Y', e0(`Y',`Y+10')
		replace prob=prob`Y' in `samp-`X''
		replace exp=exp`Y' in `samp-`X''
}
local samp=_N-43
slist prob exp in `samp'/l

      
Many thanks for your help in advance.


Amani
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index