Statalist


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

st: re: matrix command: vecdiag?


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: matrix command: vecdiag?
Date   Sun, 2 Sep 2007 21:39:15 -0400

Tiago's problem is that he wants to read a lot of separate data files, compute some summary statistics from each one and assemble them. He wanted to use a Stata matrix. It is much easier to use a new Stata dataset. Take auto.dta and save 5 files, each one containing the observations for rep78==1,2,3,4,5. Then

postfile ppp mu sigma str20 fn using summfile, replace
forv i=1/5 {
use rep`i',clear
qui sum price
local fn rep`i'.dta
post ppp (r(mean)) (r(sd)) ("`fn'")
}
postclose ppp
use summfile
desc
lesc
l

will produce a new Stata dataset with the desired contents: mean, std.dev. and the name of the file from which they were computed.

Kit

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index