Statalist


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

st: re: data manipulation


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: data manipulation
Date   Wed, 27 Jun 2007 16:13:28 -0400

Austin gave an example based on observation offsets. You could also do it with -reshape-:

clear
input x y
1 .
2 .
3 .
. 4
. 5
. 6
end

g int obs = mod(_n-1,3)+1
egen xx=rowtotal(x y)
drop x y
g int group = int((_n-1)/3)
reshape wide xx, i(obs) j(group)
list


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