There is nothing wrong with the block of code shown. The problem is certainly with your use of multiple files.
Presumably you have a line like
use `file'
somewhere in your code - you need to make this
use `file', clear
because Stata is refusing to open the next file as changes to the currently open file would be lost.
David
[email protected]
-----Original Message-----
foreach var of varlist A-D{
count if `var' == 0
local i = r(N)
local sum = `sum' + `i'
}
di `sum'
But this time, after numbers of zeros for each variable and
total sum of zeros are vertically shown, following error
messages appear:
# The same messages are shown after running the statements
pertaining to the 2nd question.
no; data in memory would be lost
r(4);
Actually, I try to process multiple dta files using
foreach file in mat1982 mat1983 mat1984{
...
}
in the same do file, which might have provoked these messages.
*
* 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/