Statalist The Stata Listserver


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

st: absolute values from a matrix


From   "Tom Boonen" <tom.boonen.maiden@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: absolute values from a matrix
Date   Thu, 9 Nov 2006 09:59:02 -0500

Hi,

is there an elegant way to create a matrix that contains the absolute
values of the entries of another matrix?

Something like:

matrix w = (1 , -1 \ 2,	-2)
matrix list w

*w[2,2]
*c1  c2
*r1   1  -1
*r2   2  -2

* But then:

. matrix w = abs(w)
type mismatch
r(109);

Any ideas? Thank you very much!

Tom
*
*   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/



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