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/