Christian wrote:
I have a *.do file in which I execute two loops, one
inside the other.
-----Example begins------
forvalues i = 1/3 {
g h`i' =0 ....
local n = _N ....
forvalues j = 1/`n'{
.....
replace h`i' = expression if id==`j'
}
}
-----Example Ends----------
The first time through the inner loop (i = 1), it works
fine. And it is also fine for the first iteration of the
second time through (i =2 j = 1). After that, I get an
error message: r110 h Ambiguous Abbreviation.
- and Friedrich suggested:
. set varabbrev off
==============================================================
With the following do-file I can not reproduce Christian's
problem, neither with -varabbrev off- nor -on-, and neither
in Stata 10 nor 9.
clear
set obs 10
gen id=_n
forvalues i = 1/3 {
g h`i' =0
local n = _N
forvalues j = 1/`n'{
replace h`i' = id^`i' if id==`j'
}
}
Something else must be wrong. Suggestion:
. set tracedepth 1
. set trace on
Hope this helps
Svend
__________________________________________
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000 Aarhus C, Denmark
Phone: +45 8942 6090
Home: +45 8693 7796
Email: [email protected]
__________________________________________
*
* 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/