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 <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Sorting relationship dates to get a correct chronological sequence
Date   Mon, 10 Jan 2011 10:17:39 +0000

The extended missings .a  ... .z may be of use. However, they can't
easily be combined with real dates as 2011 < .a regardless.

Nick

On Mon, Jan 10, 2011 at 10:05 AM, Anna Reimondos <areimondos@gmail.com> wrote:
> Dear Nick
> Thanks for the reply, I see what you mean. It looks like I will need
> to do some work on the data to achieve my desired result; I will try
> imputing the dates based on some logical rules about the relationship
> orders.
>
> Cheers
> Anna
>
> On Mon, Jan 10, 2011 at 8:31 PM, Nick Cox <njcoxstata@gmail.com> wrote:
>> 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 <areimondos@gmail.com> 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