Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: convert 5 rows to one observation


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: convert 5 rows to one observation
Date   Tue, 15 Jun 2010 21:41:09 +0100

egen col = seq(), to(5)
egen row = seq(), block(5)
reshape wide varname, i(row) j(col)

where varname is your variable name. 

Also check out -destring-. 

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

Paul O'Brien


i have data on patients i one variable with 5 rows for each patient and
want to convert to one observation per patient. 

a
b
c
d
e
1
2
3
4
5
s
t
u
v
w
6
7
8
9
10

to 

a1s6
b2t7
etc


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index