Statalist The Stata Listserver


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

RE: st: RE: help expanding the dataset by n observations


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: help expanding the dataset by n observations
Date   Sun, 26 Nov 2006 16:57:03 -0000

Correct. Thanks for the fix. 

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

Scott Merryman
 
> (Also, in the second approach, I believe the -foreach- 
> statement would need
> to be written as:  foreach y of num 1983 1986 1989 1990 1993 
> 1994 1997 1998
> 2001/2004 { )
 
Nick Cox
 
> > (2) change of data shape.
> > 
> > (a) -reshape-
> > (b) new variables
> > (c) -reshape- back
> > 
> > egen id=group(county fip)
> > reshape wide vbl, i(id) j(year)
> > foreach y of num 1983 1986 1989 1990 1993 1994 1997 1998 2001-2004 {
> > 	gen vbl`y' = .
> > }
> > reshape long vbl, i(id) j(year)
> > drop id

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