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

st: RE: RE: A tricky reshape


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: A tricky reshape
Date   Fri, 25 Jun 2004 12:55:36 +0100

Andreas Kuhn's way is very good. 

Mine can be improved. 

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

So long as you are using stubs 
Jan Feb Mar Apr May Jun Jul Aug Sep 
Oct Nov Dec, try this: 
 
di "`c(Mons)'"
tokenize `c(Mons)' 
forval i = 1/12 { 
 	forval j = 1/7 { 
 		rename ``m''X`j'  X`j'`m' 
 	}
}
reshape long X1 X2 X3 X4 X5 X6 X7, j(Month) i(State) 

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

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