[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

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


Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

* For searches and help try:

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