Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: reshaping data
From
Paul Byatta <[email protected]>
To
statalist <[email protected]>
Subject
st: reshaping data
Date
Wed, 27 Nov 2013 03:47:22 -0800 (PST)
Hi Statalist,
I have a dataset in which an exact set of questions is asked about multiple pupils, hence the data reported looks like this in Stata. For illustration, the data is from 3 pupils.
pupid_1 name_1 age_1 sch_1 pupid_2 name_2 age_2 sch_2 pupid_3 name_3 age_3 sch_3
231 Jay 13 DA 232 Ren 12 SP 233 Mimi 14 HH
I am wondering is there a short way I could turn the data from the current wide format (where everything appears on the same row) to a long format (where each pupil information will appear on its own row) that will look like below?
pupid name age sch
231 Jay 13 DA
232 Ren 12 SP
233 Mimi 14 HH
I have looked at -reshape- command and it doesnt seem to allow me retain the core of the variable name, ie drop the "_#" part of variable names above and retain the main part.
Thanks for the help
Paul
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/