Statalist


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

st: double equal sign with -matrix-


From   Jacob Wegelin <jwegelin@vcu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: double equal sign with -matrix-
Date   Wed, 11 Mar 2009 14:15:49 -0400

Is there any reason why, with  -matrix- , a double equal sign has the
same effect (apparently) as a single equal sign?

The code below demonstrates that the double equal sign, "==", is not
tolerated in an assignment of a value to a scalar---presumably because
it is used as a logical operator to test for equality--but that, with
the -matrix- command, the double equal sign seems to mean the same as
a single equal sign.

. clear all

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

. mat lis A

A[2,2]
    c1  c2
r1   1   2
r2   3   4

. mat okay=A

. mat lis okay

okay[2,2]
    c1  c2
r1   1   2
r2   3   4

. matrix weird==A

. mat lis weird

weird[2,2]
    c1  c2
r1   1   2
r2   3   4

. scalar asExpected==5
varlist not allowed
r(101);

. scalar asExpected=5


Can anyone shed light on this?

Thanks

Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A.
E-mail: jwegelin@vcu.edu

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



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