Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: problem with -mat_capp- command


From   "Zurab Sajaia" <[email protected]>
To   <[email protected]>
Subject   Re: st: problem with -mat_capp- command
Date   Tue, 13 Feb 2007 14:51:53 -0500

Ken,

Thanks for the additional explanations, but one more thing, if you use a Mata command then we end up with much bigger problem then we have now:
-mat_capp- will stop working for the pre-Mata versions of Stata ...

If there are no more efficient ways to read colnames containing spaces, I'd rather resort to this kind of loop:

tempname TMP
forvalues i=1/`=colsof(M)' {
matrix `TMP'=M[....,`i']
local colnames `"`colnames' "`: colnames `TMP''""'
}

Zurab

----- Original Message ----- From: <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 13, 2007 1:59 PM
Subject: Re: st: problem with -mat_capp- command



Zurab Sajaia <[email protected]> asked about StataCorp fixing
undocumented command -mat_capp- and provided example code

.matrix a= 1,2
.matrix colnames a="one two" three
.matrix b=1\2\3
.mat_capp c : a b, miss(.z)
and suggested a possible fix using the -quoted- option with an
extended macro function

problem seems to come from the line:
mat colnames `bb12' = `:colfullnames `b1'' `:colfullnames `b2''

and possible solution could be
mat colnames `bb12' = `:colfullnames `b1', quoted' `:colfullnames `b2',
quoted'
He then says

(from reading the help, I was under impression that option 'quoted' was
for -coleq-, roweq- only but it seems doing the same thing
with -colfullnames- as well)
For those interested, see -help matmacfunc-.  The -quoted- option
is only documented with the -roweq- and -coleq- extended macro
functions.  The reason it is not documented with -rowfullnames-
(etc) is that it does something partly reasonable, but not what
you really want in all cases.  I suggest avoiding the -quoted-
option except where it is documented (-coleq- and -roweq-).

In my first response, I indicated I would attempt to fix
-mat_capp- and report back if there were any difficulties.
Zurab's proposed solution caused some unintended problems with
other official Stata commands that use mat_capp.  So instead, I
fixed mat_capp using calls to the st_matrixrowstripe() Mata
function (type -help mata st_matrixrowstripe()-).  I am now
running the full suite of StataCorp test scripts to see if there
are any other hidden problems with my fix.  Again, assume that
the -mat_capp- fix will be in the next update later this week.

A general comment:  Try to avoid putting spaces into Stata matrix
name stripes.  It is bound to cause you problems at some step
along the way because there are still many routines that are not
robust to seeing spaces in the name stripes.

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/

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