Tanaka Yoshi <[email protected]> asks,
> I have a question about the matrix calculation in the form of string.
> [...]
>
> . mata
> : X=("a","b")
> : Y=("c","d")
> : Z=X+Y
> : Z
> 1 2
> +-----------+
> 1 | ac bd |
> +-----------+
> : end
>
> the result is (ac, bd), but the expression i want to get is (a+c, b+d).
I assume Tanak means that the result is ("ac", "bd") and what he wants
is ("a+c", "b+d"). One solution is
: Z = X :+ "+" :+ Y
: Z
1 2
+-------------+
1 | a+c b+d |
+-------------+
Above I used the :+ operator, see -help [m2] op_colon-.
Another solution is
: Z = X + ("+", "+") + Y
: Z
1 2
+-------------+
1 | a+c b+d |
+-------------+
-- Bill
[email protected]
*
* 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/