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

st: Re: two questions about matrix operations


From   "Katsuhide Isa" <[email protected]>
To   [email protected]
Subject   st: Re: two questions about matrix operations
Date   Thu, 06 Jan 2005 19:30:27 +0900

Dear Ulrich,

Thank you for your advice.


2nd question has been solved, thanks to your advice.
As you pointed out, -local- was merely redundant.
Admittedly, I surely made elementary mistakes.
# though some trouble still remains, as mentioned below.


As to the 1st question, when I ran the following, 

>foreach var of varlist A-D{
>	count if `var' == 0
>	local sum = `sum' + r(N)
> }
>di `sum'

following error messages are shown:

Unknown function +r()
r(133);

Then, I tried the slightly modified statements below:

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.


I'd appreciate additional advice.


K.I.
*
*   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