Statalist


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

st: RE: RE: Matrix command - vecdiag?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Matrix command - vecdiag?
Date   Tue, 4 Sep 2007 19:36:07 +0100

This thread was resolved otherwise, but I just want 
to comment on one detail. 

Brent's code pivoted on looping over dataset 
names using 

local rownames1 = "`rownames1' `u'_replication_number_`i'.dta"

As Kit pointed out, this will be problematic given the stops
(periods) but it is also fragile because evaluating (using =) rather
than copying (not using =) means that the limits on length 
of string expressions will bite. Don't evaluate unless you must. 

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

Brent Fulton
 
> 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:
> 
> 
> 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"

*
*   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