Statalist


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

Re: st: matrix - how to copy row names into data?


From   n j cox <n.j.cox@durham.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: matrix - how to copy row names into data?
Date   Mon, 16 Jul 2007 19:32:55 +0100

An option for doing this was one of the features
of an -svmat2- published in STB-56 in 2000, in
Stata terms a long time ago.

In Stata 10,

. search svmat

will not reveal this publication. You have
to push hard:

. search svmat, historical

reveals the StataCorp judgement that you should be
using Mata instead. However, StataCorp have not
marked their own command -svmat- as historical,
so we have the interesting anomaly that -svmat-
is well documented, but not a command that improves
upon it, at least by adding handles. In the document
-njc_stuff.hlp- available from SSC I annotate the module
in question as partially obsolete given Mata, so that's
my judgement compared with the official one.

Anyway, -svmat2- is a solution to your problem, but StataCorp
have made it more difficult for you to find that out.
They may be right that you should be using Mata
instead, but without context no judgment on that is
possible.

Nick
n.j.cox@durham.ac.uk

Ada Ma asked

I have a matrix:
     A1
A1  x
B2  x
C3  x


The x's are the numbers, I can svmat them into data without any
problem, but I want to copy the names of the rows (A1, B2, C3) into
the data as well (so that I can export the rownames as well as the
numbers into a CSV file).  How do I do that?

I know I can store the rownames into a local and then stick the
rownames into the data one by one, but I think there must be faster
neater ways to do that.  All suggestions welcomed!

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