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

From |
"Brent Fulton" <fultonb@berkeley.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Matrix command - vecdiag? |

Date |
Sun, 2 Sep 2007 18:04:59 -0700 |

Hi Tiago, I'm fairly sure you cannot store a non-numeric value in a matrix (as opposed to a list in R that accepts strings). However, you could store your file names as row names in the matrix. Inside your loop, add: local rownames1 = "`rownames1' `u'_replication_number_`i'.dta" Then outside your loop, add: matrix rownames M = `rownames1' Note that a space precedes the first rowname. I'm not sure if that matters, but you could use the following the first time through your loop. local rownames1 = "`u'_replication_number_`i'.dta" Best, Brent Fulton -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of tiago.pereira@incor.usp.br Sent: Sunday, September 02, 2007 3:19 PM To: statalist@hsphsun2.harvard.edu Subject: st: Matrix command - vecdiag? Dear Statalisters, I have the following do file (and a lot of .dta files): clear set obs 100 tempname M forvalues i = 1/100 { forvalues u = 1(0.1)1.6 { use "C:\TEST\RR=`u'_replication_number_`i'.dta" set more off quietly summarize A matrix `M' = nullmat(`M') \ ( r(mean), r(N)) clear } } svmat double `M' , name(results) -svmat- saves results as: results1 results2 1.2 56 1.3 85 Nonetheless, I would like to add to the matrix a third collumm, which will have the name of the .dta file. For example, results1 results2 results3 1.2 56 RR=1.2_replication_number_1.dta 1.3 85 RR=1.2_replication_number_2.dta . . . Is this difficult to do without changing much my simple do file? I have tried the vecdiag option, unsuccessfully, however. I will be very grateful for any help again. Best, Tiago * * 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/

**Follow-Ups**:**st: RE: RE: Matrix command - vecdiag?***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: Matrix command - vecdiag?***From:*tiago.pereira@incor.usp.br

- Prev by Date:
**st: Matrix command - vecdiag?** - Next by Date:
**st: re: matrix commands: vecdiag** - Previous by thread:
**st: Matrix command - vecdiag?** - Next by thread:
**st: RE: RE: Matrix command - vecdiag?** - Index(es):

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