Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: foreach bug


From   Ada Ma <heu034@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: foreach bug
Date   Tue, 12 Oct 2010 21:15:37 +0100

Hi Statalist,

I have found a bug in the -foreach- command.  It wasn't there in
version 10.  The problem is that for the last element of the loop, the
actions within the braces are repeated twice.  For example when I run
these commands:

clear
foreach area in ayrshire_arran borders dumfgall fife {
append using "$pathout/listsize_200708_`area'"
erase  "$pathout/listsize_200708_`area'.dta"
}
save "$pathout/listsize_200708", replace


In the <<listsize_200708.dta>> file I will find two copies of every
line of data that is within <<listsize_200708_fife.dta>>.  It would be
great if it can be fixed.

Many thanks.

Ada Ma


-- 
Ada Ma
Research Fellow
Health Economics Research Unit
University of Aberdeen, UK.
http://www.abdn.ac.uk/heru/
Tel: +44 (0) 1224 555189
Fax: +44 (0) 1224 550926
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index