Statalist


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

st: RE: Data Manipulation


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Data Manipulation
Date   Thu, 1 Nov 2007 18:01:58 -0000

This looks like a -reshape- from wide to long. You may have 
to do some renaming first. -search rename- points to several 
sources of guidance. 

Raphael Fraser

I have the following data:

id  vnum  msys1a   msys1b date1   msys2a   msys2b  date2   msys3a
msys3b  date3
304  1     110      110   02jan1960              .        . 
.        107      120   04jan1960
304  2     110      110   02jan1960              .        .
.        107      120   04jan1960
304  3     110      110   02jan1960              .        .
.        107      120   04jan1960
545  1       .        .                    .           109       99
10apr1960  87      130   23aug1961
545  2       .        .                    .           109       99
10apr1960  87      130   23aug1961
545  3       .        .                    .           109       99
10apr1960  87      130   23aug1961

 I would like to put it in this format:

id        date     vnum   msys1   msys2   msys3
304   02jan1960      1     110     110     111
304               .        2      .        .          .
304   04jan1960      3     107     120      96
545               .        1      .        .          .
545   10apr1960      2     109      99     100
545   23aug1961     3      87     130     130

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