Elisabeth indicated difficulties with mkmat, and Nick responded
"For each call to -mkmat- there is a
(1) -preserve- of your data
and a
(2) double loop over your variables and your
observations filling in the matrix element by
element
To avoid the problem (0) you might write
an alternative to -mkmat- as C code and make
it a plug-in.
To minimise the problem (1) you could check
to see that you are not working with a
relatively small subset of a relatively
large dataset, because otherwise the
-preserve- will be relatively expensive. "
I don't think that there is any good reason for a preserve in this
context; I believe it can be replaced with a sort (which of course is
not costless, but probably less burdensome than copying the whole data
set). Here is a version of mkmat that with cursory testing produces the
same result as official mkmat, but appears to reduce the time by at
least 1/3 or so (tested on 74000 observations). If called per
observation, getting rid of those preserve/restores should save quite a
bit more.