Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: matsum - matrix sums of rows

From   Fabrizio Gilardi <>
Subject   Re: st: RE: matsum - matrix sums of rows
Date   Thu, 24 Aug 2006 15:25:43 +0200

Thank you very much indeed. My problem was precisely identifying the name of the matrix with the results. All fine now.

Le 24 août 06 à 15:14, Nick Cox a écrit :

A third alternative to your search is to look at the program
itself. It is just more Stata.

After your command you have a new matrix -r- in memory,
so its elements are

r[1,1], r[2,1], ....

In the help,

matsum A [, row(mat_name) column(mat_name) all(mat_name) display format(fmt)]

Computes and/or displays the row-wise, column-wise and over-all maximum,
minimum, and sum over the elements of a matrix. More than one operator may
be specified simultaneously. These commands default to the column-wise

the implication is that you are naming a new matrix with whatever you
supply as mat_name.


Fabrizio Gilardi Ph.D.

I've been using the -matsum- command written by Jeroen Weesie. I
would like to access the results (notably the sums of rows) to use
them in further operations: how can I do this? I've perused the help
and Statalist's archives, but I couldn't find a solution.


. matrix A=(1,2,3 \ 4,5,6)

. matrix list A

     c1  c2  c3
r1   1   2   3
r2   4   5   6

. matsum A, r(r) d

row-wise sums of matrix A[2,3]

r1   6
r2  15

How can I access the sum of the first row of A (i.e. 6) and that of
the second row of A  (i.e. 15)?

I'm still using Stata 7, but I should receive Stata 9 soon.
*   For searches and help try:
Fabrizio Gilardi, PhD
Institut d'Etudes Politiques et Internationales
Université de Lausanne
Bâtiment Humense
CH-1015 Lausanne
Phone +41 21 692 31 48
Fax + 41 21 692 31 45

*   For searches and help try:

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