Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: RE: sum of rows in stata matrix

 From Shuaizhang Feng <[email protected]> To [email protected] Subject Re: st: RE: sum of rows in stata matrix Date Thu, 10 Oct 2013 23:32:44 +0800

```thank you, that works fine!  SZ

On Mon, Oct 7, 2013 at 12:18 PM, Kieran McCaul <[email protected]> wrote:
> ...
>
>
> matrix A = (1,2,9\2,7,5\2,4,18)
> matrix list A
>
> * This sums across rows of A
> matrix X1 = J(3,1,1)
> matrix list X1
>
> matrix B1 = A*X1
>
> matrix list B1
>
> *This sums down columns of A
> matrix X2 = J(1,3,1)
> matrix list X2
>
> matrix B2 = X2*A
>
> matrix list B2
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Shuaizhang Feng
> Sent: Monday, 7 October 2013 10:45 AM
> To: [email protected]
> Subject: st: sum of rows in stata matrix
>
> Dear all:
>
> Suppose I have a matrix A in stata and I want to calculate sum of rows
> for each column. What would the most simple way to do it? thanks.
>
> SZ
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/

--
Shuaizhang Feng