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

From |
Kit Baum <baum@bc.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: how do I suppress output in Mata? |

Date |
Mon, 16 Nov 2009 06:34:43 -0500 |

<> I imagined that you wanted it in Stata, as you were returning it. This illustrates how you can get the object back to another Mata routine without having it displayed. mata: void district(real matrix distmat) { st_view(d, ., "dist") distmat = J(rows(d),rows(d),0) for(i=1; i<=rows(d); i++) { for(j=1; j<i; j++) { distmat[i,j] = (d[i]==d[j]) } } _makesymmetric(distmat) return } void calldist() { "Now in calldist" district(distmat) "No output yet" distmat[.,1] } end mata: calldist() Kit On Nov 16, 2009, at 2:33 AM, statalist-digest wrote: > Kit - Thank you for not only suggesting the command "st_matrix" but for reworking my code to make it so much more efficient. When you use the "return()" command instead, the whole matrix prints to the screen, which is unfortunate when the matrix is large. > > The one question I have is that the "st_matrix" command saves the matrix district() creates to Stata, not mata. I can then import the matrix to mata using the st_matrix command, but that seems like a waste of memory. Is there a way to put it in mata in the first place? Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html * * 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/

- Prev by Date:
**st: RE: AW: RE: AW: label define** - Next by Date:
**RE: st: How to plot frequencies of Likert scale over two groups (data shaping question)** - Previous by thread:
**Re: st: re: how do I suppress output in Mata?** - Next by thread:
**st: redprob: could not calculate numerical derivatives... r(430)** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |