Perhaps I should explain my second comment. -generate- never sees the
macro as such, as Stata substitutes macro names by their contents before
passing the instruction to -generate-. So -generate- sees a set of row
names starting with Frag300. As that is not the name of one of your
variables, and as it is not indicated to be a string literal by
delimiting " ", Stata doesn't know what it is.
Nick
[email protected]
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 30 May 2008 13:28
To: [email protected]
Subject: st: RE: saving a matrix with rownames
Your first works for me. The variable receives the row names as
intended.
I wouldn't expect the second to work, as it's illegal.
-svmat2- from STB-56 added a way to save row names that is, in my view,
better than either. You need to go
. search svmat2, historical
to see locations. The grading by StataCorp of this as historical is not
quite accurate, in so far as -svmat- remains part of Stata and the
user-written -svmat2- added a feature in 2000 that is yet to be matched
by the official command.
Nick
[email protected]
Data Analytics Corp.
I created a matrix, M, with row names such as Frag300, Frag400, etc. I
want to save the matrix as a set of variables so I used svmat, which
worked perfectly. But I also want to save the row names as a variable,
say rown. I used the following:
local names : rownames M
gen str rown = "`names'"
and got the variable rown, but it's blank. I also used
gen str rown = `names'
but got an error message saying Frag300 not found. How do I save the
row names as a variable?
I'm using Stata 10 on a Vista machine.
*
* 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/