|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: mata: Colon operators result in matrix output to screen?
On Dec 3, 2007, at 1:03 PM, Thomas Masterson wrote:
A mata question: when I use the function affinity() [code below] I
get the results I expect, but the colon comparison operations
result in the resulting matrix being written to the Stata results
window [quite a nuisance for logging purposes]. Any thoughts why
this happens?
You need to assign the result to something -- otherwise (like other
Mata operators) the result is printed to the screen:
: foo = (1,2,3)
: foo :<= 2
1 2 3
+-------------+
1 | 1 1 0 |
+-------------+
: foo = (foo :<= 2)
: foo
1 2 3
+-------------+
1 | 1 1 0 |
+-------------+
Also, be aware of the order of operations. The operators :<= and :>=
both have higher precedence than either + or -, which means that you
may need to use parentheses.
-- Phil
*
* 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/