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: sortpreserve option


From   Sergiy Radyakin <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: sortpreserve option
Date   Wed, 14 Aug 2013 18:29:48 -0400

On Wed, Aug 14, 2013 at 5:15 PM, David Kantor <[email protected]> wrote:
> At 03:14 PM 8/14/2013, Sergiy Radyakin wrote:
>>
>> What is the effect of inclusion of the -sortpreserve- option in the
>> declaration of a program, which might change the number of
>> observations? (add or remove)
>
>
> My understanding is that it should have no effect on the number of
> observations.
Dear David, just to make sure we are talking about the same thing. The
program _is expected_ to make changes to data by adding/removing
observations. Can I still declare it -sortpreserve-?
Specifically, what will happen to the newly added observations? will
they end up in the end of the restored-order-dataset? in the beginning
of it? (elsewhere if other possibilities exist?)

> Its effect is to insure that when the program exits, the data are left in
> the same sort order as before.

Yes, that's by the book. But we now have more data, so how would Stata
know where to put the new observations which it hasn't seen before?

> That may or may not be desirable, depending on your needs.
If there is reasonable/predictable/logical behavior of sortpreserve in
this case I definitely like to know it. Whether it is desirable,
depends on what it is.

Best, Sergiy Radyakin

> It may take a little extra run-time.
>
> I have written one program where I made it an option -- whether to run it as
> sortpreserve. There was a little trick to make that happen, which I can
> explain if you want.

I envision this as:
http://radyakin.org/statalist/2013081401/myprog.ado
with any sort-destructive actions to be taken in the common part.
Perhaps it can be more elegant, but this is not what I am looking for now.

Thank you for your help
Sergiy

> HTH
> --David
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index