Bookmark and Share

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]

Re: st: Sorting relationship dates to get a correct chronological sequence


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Sorting relationship dates to get a correct chronological sequence
Date   Mon, 10 Jan 2011 09:31:17 +0000

Your problem does not look soluble to me unless you impute dates that
are consistent with what you can infer about the time order of
relationships.

Nick

On Mon, Jan 10, 2011 at 2:50 AM, Anna Reimondos <[email protected]> wrote:

> I am having trouble thinking of a way to sort my data they way I would like to.
>
> What I am trying to do is to sort people's relationships in the
> chronological order that they happened.
>
> I have separate pieces of information about the start and end dates of
> all 1) cohabitations 2) marriages.
>
> EXAMPLE
> A person might have had 5 relationships:  3 cohabitations and 2
> marriages. The second marriage is still ongoing.
>  In long format the data looks like:
>
> Person    Relationship                 Star Year     End Year
> 1             Cohabitation 1              2001             2001
> 1             Cohabitation 2              -1 missing    -1 missing
> 1             Cohabitation 3              -1 missing     -1 missing
> 1             Marriage 1                    1998              2000
> 1             Marriage 2                     2008            -20 (Ongoing)
>
>
> I have tried sorting the data by start year, to get the chronological
> order correct but obviously run into problems with the relationships
> that have missing start or end dates since these have negative values
> and therefore appear first, as such:
>
> Person  Relationship                 Star Year     EndYear
> 1             Cohabitation 2              -1 missing    -1 missing
> 1             Cohabitation 3              -1 missing     -1 missing
> 1             Marriage 1                    1998              2000
> 1             Cohabitation 1                2001            2001
> 1             Marriage 2                     2008            -20 (Ongoing)
>
>
> However, this is wrong because obviously Cohabitation 2 and
> Cohabitation 3 must have occured *after* Cohabitation 1.
> The actual correct order I am trying to achieve is : Marriage 1,
> Cohabitation 1, Cohabitation 2, Cohabitation 3, Marriage 2.
> I was hoping someone would have a suggestions of how I could achieve
> the correct sequence. I think I will have to use a loop maybe?

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index