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

st: double equal sign with -matrix-

From   Jacob Wegelin <>
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

    c1  c2
r1   1   2
r2   3   4

. mat okay=A

. mat lis okay

    c1  c2
r1   1   2
r2   3   4

. matrix weird==A

. mat lis weird

    c1  c2
r1   1   2
r2   3   4

. scalar asExpected==5
varlist not allowed

. scalar asExpected=5

Can anyone shed light on this?


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

*   For searches and help try:

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