Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: reshape efficiency help


From   "Neil Shephard" <mdeasnds@fs1.ser.man.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: reshape efficiency help
Date   Tue, 12 Apr 2005 13:15:04 +0100

> I am trying to reshape a panel data set and am sure
> there is a more efficient way than what I've tried so
> far and was hoping someone could help. 
> 
> Let's say I have seven variables, an "id", three
> income variables (inc80, inc81, inc82) and three
> education variables (ed80, ed81, ed82). The way I've
> been reshaping a data set like this is to perform a
> reshape, save the file, do another reshape and save
> that file, and then merge the two together by "id". Is
> there a way to reshape the entire data set in one
> step?
> 

Assuming your data is in wide format you could simply...

reshape long inc ed, i(id) j(year)

HTH's

Neil

Neil Shephard
Genetics Statistician
ARC Epidemiology Unit, University of Manchester
neil.shephard@man.ac.uk
nshephard@gmail.com

"If your result needs a statistician then you should design a better experiment" - 
Ernest Rutherford

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