Statalist


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

Re: st: saving a matrix with rownames


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: saving a matrix with rownames
Date   Fri, 30 May 2008 11:12:44 -0400

Dear Walt,

Perhaps this is what you were originally planning to do?

//------------------------------------------------------------
clear
matrix A=1

local names : rownames A
gen names=""
forvalues i=1/`: word count `names'' {
  replace names=`"`: word `i' of `names''"' in `i'
}
//------------------------------------------------------------

Best regards,
   Sergiy Radyakin




On 5/30/08, Data Analytics Corp. <dataanalytics@earthlink.net> wrote:
> Good morning,
>
> 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.
>
> Thanks,
>
> Walt
>
> --
> ________________________
>
> Walter R. Paczkowski, Ph.D.
> Data Analytics Corp.
> 44 Hamilton Lane
> Plainsboro, NJ 08536
> ________________________
> (V) 609-936-8999
> (F) 609-936-3733
> dataanalytics@earthlink.net
> www.dataanalyticscorp.com
>
> *
> *   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/
>
*
*   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