Statalist


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

Re: st: transposing data set


From   "Eva Poen" <eva.poen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: transposing data set
Date   Fri, 18 Jul 2008 19:27:06 +0100

Mike,

see -help reshape-. Your data is in wide format, and you want it in
long format. Something along the line of

reshape t, i(id) j(time)

should do the trick, assuming that the name of the participant
identifier is "id". Your new time variable would be called "time", and
your levels of t1 etc. would be recorded in variable "t". If you don't
have a person identifier, you need to create one before using
-reshape-. Assuming one observation per person, you could simply do

gen id = _n

Hope this helps,
Eva


2008/7/18 Mike Hine <mhine@sprott.carleton.ca>:
> Hello
> I am new to Stata and am trying to manipulate my data set so I can do some
> multilevel analyses on it.
>
> Currently, each record in the data set represents one participant's results
> from an experiment.  Included in each record are some participant level
> variables (personality measures, performance etc) and some repeated measures
> (various state emotion variables from t1 through t6 among others)
>
> Essentially I would like to re-organize the data set so that each record
> represents a time period from the experiment.  So if I have 100 participants
> I would end up with 600 records.  I would like the participant level
> variables replicated for each new t1 through t6 record per participant.
>
> I perused the data management manual and saw xpose which seems like it would
> be helpful but not a complete solution.
>
> Thanks for any help you can provide.
>
> Mike
>
>
> *
> *   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/
>
*
*   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   |   What's new   |   Site index