Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: mata: columns of different eltypes in a transmorphic matrix
From
"Joseph Coveney" <[email protected]>
To
<[email protected]>
Subject
Re: st: RE: mata: columns of different eltypes in a transmorphic matrix
Date
Thu, 10 Oct 2013 21:27:21 +0900
Nick Cox wrote:
This is an excellent answer, but one simple point seems submerged. An
elementary strategy is to put numeric variables in a numeric matrix
and string variables in a string matrix. I've often done that in Mata
programs, and never yet felt the need for structs, pointers, and so
forth.
--------------------------------------------------------------------------------
I agree. I'm not sure what László's needs are for keeping Stata dataset string
and numeric data in sync in a single location in Mata. Perhaps, if he'd like to
elaborate, someone on the list could offer suggestions that don't entail structs
or pointer vectors, List or Array classes, and the like.
As you could see from my example, taking the long way round involves additional
programming steps that in turn give rise to opportunities for logical errors,
such as -select(X, missing(X[1,]))- instead of -select(X, !missing(X[1,]))-, and
syntax errors, such as -PointerVector = (A, B)- instead of -PointerVector = &A,
&B-, among others that I haven't noticed yet.
Joseph Coveney
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/