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

RE: st: saving a matrix with rownames

From   "Nick Cox" <>
To   <>
Subject   RE: st: saving a matrix with rownames
Date   Fri, 30 May 2008 13:54:31 +0100

This is true but not Walt's problem. He is dealing with the rownames of
a matrix. 


Gabi Huiber

The command

unab myvarnames: _all

will collect the names of all the variables in your dataset in the
local macro called `myvarnames.' That's usually all you need for doing
things automatically to each variable -- like running summary stats,

But if you must have these names collected as observations in a
variable, then you could create a new, blank dataset, while this local
macro is in memory. You call this new dataset say myvars.dta, set it
to have one variable, called say myvarnames, then have Stata enter
each word in the `myvarnames' local as an observation in myvarnames,
and finally save, replace.

On 5/30/08, Data Analytics Corp. <> wrote:

>  I created a matrix, M, with row names such as Frag300, Frag400, etc.
> want to save the matrix as a set of variables so I used svmat, which
> perfectly.  But I also want to save the row names as a variable, say
> 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
> names as a variable?
>  I'm using Stata 10 on a Vista machine.

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index