Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: foreach bug


From   Ada Ma <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index