Statalist


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

st: Splitting Observations if Ties are Present


From   Thomas Speidel <thomas@tmbx.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Splitting Observations if Ties are Present
Date   Tue, 30 Oct 2007 14:12:52 -0600

I have a dataset that looks like this:

        date      value   maxtag   mintag   firsttag   lasttag  
    Jan 2001     13.616        1        .          1         .  
    Oct 2001      2.632        .        1          .         .  
    Jul 2007      6.474        .        .          .         1  

*tag indicates whether a particular value was the first, last, min or 
max.  Obviously, the possibility of ties exist.  In this case 13.616 is 
both the max and first value.

What I am trying to get at is single observation dataset that looks like 
this:

firsttag  mintag   maxtag   lasttag  
13.616      2.632       13.616   6.474

I have been able to do so when no ties are present (using sxpose after 
some data management).  However, when ties are present I need to be able 
to perhaps add one or two more observations to the initial dataset to 
reflect the presence of ties (in this case I would need to add onother 
row for Jan 2001 and change the max and firsttag accordingly so that 
only one tag exists for each row).  Perhaps someone has a better suggestion.

Thanks,
Thomas

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