Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: matrix stack and macro (Jun Xu)


From   [email protected]
To   [email protected]
Subject   Re: st: matrix stack and macro (Jun Xu)
Date   Sat, 13 Jul 2002 14:43:43 -0500

Jun Xu <[email protected]> asks:

> One more question about matrix in ado program.
> 
> *******************************
> tempname A A1
> ...
> ...
> ...
> sum `var'
> matrix `A'=(`r(mean)')
> matrix `A1'=nullmat(`A1')\`A'
> *******************************
> The purpose of using tempnames, as we know, is to make all the names 
> temporary within this program in case any naming conflict from what's left 
> over before we invoke this program.  No problem with it.  However, it seems 
> that the last line "matrix `A1'=nullmat(`A1')\`A'" simply not working.  I 
> have tried around and found out that I have to use a real named matrix like 
> A instead of the macro-referred `A' for this line of syntax to work. Is that 
> true that no matter what, I have to put a matrix name, instead of a local 
> macro after "\" to stack matrix?  Thanks ahead!!!

The "\" is also used as an escape character for a few cases
including the case when you want the left single quote to be
treated as a left single quote and not as the marker for the
beginning of a local macro.

You just need to put a space between the backslash and the left single
quote like this

        matrix `A1'=nullmat(`A1')\ `A'

You can read about it on page 164--165 of [P] matrix define.

Ken Higbee    [email protected]
StataCorp     1-800-STATAPC

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index