Bookmark and Share

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


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

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


From   Shuaizhang Feng <shuaizhang.feng@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <kieran.mccaul@uwa.edu.au> 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Shuaizhang Feng
> Sent: Monday, 7 October 2013 10:45 AM
> To: statalist@hsphsun2.harvard.edu
> 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
https://sites.google.com/site/shuaizhangfeng/
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index