# st: RE: mata: Colon operators result in matrix output to screen?

 From "Nick Cox" To Subject st: RE: mata: Colon operators result in matrix output to screen? Date Mon, 3 Dec 2007 17:38:34 -0000

```Something like

a :<= b

is an expression, which Mata will evaluate. Perhaps you want
an assignment on the LHS, e.g.

c = a :<= b

Thomas Masterson

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?

Thanks!
Tom

real colvector affinity(real rowvector ai, real matrix aj, real
rowvector sd) {
real matrix aij, upper, lower

aij = J(rows(aj), 1, 0)
upper = J(rows(aj), cols(aj), 0)
lower = J(rows(aj), cols(aj), 0)

upper = aj
printf("upper has %4.0g columns and %9.0g rows\n", cols(upper),
rows(upper))

lower = aj

// These two operations print out the entire resulting matrix to the
screen
upper:<= ai+sqrt(sd)
lower:>= ai-sqrt(sd)

upper:& lower

aij = rowsum(upper)
printf("aij has %4.0g columns and %9.0g rows\n", cols(aij),
rows(aij))
return(aij)
}

*
*   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/
```
{"ft_lang_label":"__label__en","ft_lang_prob":0.673552,"math_prob":0.9156058,"size":1556,"snap":"2022-05-2022-21","text_gpt3_token_len":470,"char_repetition_ratio":0.09793814,"word_repetition_ratio":0.07929515,"special_character_ratio":0.29241645,"punctuation_ratio":0.18562874,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97176814,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-19T12:31:24Z\",\"WARC-Record-ID\":\"<urn:uuid:4a835830-0b70-485b-8f54-7b97a7d137eb>\",\"Content-Length\":\"7049\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:57398f0f-1004-4fc9-81d5-ea84d6a9f14e>\",\"WARC-Concurrent-To\":\"<urn:uuid:77169f6a-92b5-404f-b9ae-617157887a15>\",\"WARC-IP-Address\":\"66.76.6.5\",\"WARC-Target-URI\":\"https://www.stata.com/statalist/archive/2007-12/msg00058.html\",\"WARC-Payload-Digest\":\"sha1:UEEFCDHTRZLGR4AF26TPEUD5OYDJ5T6A\",\"WARC-Block-Digest\":\"sha1:H25UZSLVMM7EQEPBK747TEJJG7BMTD2H\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662527626.15_warc_CC-MAIN-20220519105247-20220519135247-00506.warc.gz\"}"}