Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Dates - collapsing variables for multiple records


From   "Alfonso Miranda Caso Luengo" <[email protected]>
To   <[email protected]>
Subject   Re: st: RE: Dates - collapsing variables for multiple records
Date   Wed, 28 Jul 2004 14:04:39 +0100

If I understand well I think you need to re-define your entry and exit vars. Simply copy entry (exit) to a new var, say date0 and exit0. Now redefine entry as d0 if id==0, date1 if id==1, date2 if id==2, and so on. Do something similar for exit so that exit = date1 if id==0, date2 if id==1 and so on. Finally substitute exit=exit 0 if id==num_obs (i.e., if you are at the last observation of user I).

I hope this helps.

Alfonso.

 

=====================================
Alfonso Miranda
PhD Student

Economics Department
University of Warwick
Coventry CV4 7AL
E-mail:[email protected]
WebPage: http://www.warwick.ac.uk/go/amiranda
=====================================
>>> [email protected] 07/28/04 11:46 AM >>>
I've spent a few minutes trying to read this, but it's 
too puzzling as printed given wrap-arounds and ambiguities 
on what the variable names are (e.g. are -username- and -ID- 
separate variables). 

Perhaps someone else can understand this. If not, 
you will need to re-post it. 

Incidentally, your first post on 22 July received
a reply on the same day. 

Nick 
[email protected] 

Hannah Moore BSc(Hons) wrote 
 
> What I was meaning in my previous email was I have data in this order:
> 
> username  ID  entrydate   exitdate  num_obs   date_obs1   
> date_obs2  date obs3
> 1                0      entry           exit                 
> 3              date1                 date2          date3
>   1                1      entry           exit                 
> 3              date1                 date2          date3
>   1                2      entry           exit                 
> 3              date1                 date2          date3
>   1                3     entry           exit                 
> 3              date1                 date2          date3
>    2                0     entry           exit                 
> 1               date1                   .                         .
>   2                1     entry           exit                 
> 1               date1                   .                         .
> 
>   And I would like data in this order:
> username    ID    entry     exit    num_obs
> 1                     0      entry     date1     3
>   1                     1     date1     date2     3
>   1                     2     date2    date3     3
>   1                     3    date3     exit          3
>   2                     0    entry       date1        1
>   2                     0    date1       exit        1
> 

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


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index