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" <[email protected]>
To   <[email protected]>
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 
[email protected] 

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 
[email protected] 

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