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: Drop all that are listed in an external file


From   miriam geringer <[email protected]>
To   [email protected]
Subject   Re: st: Drop all that are listed in an external file
Date   Sat, 25 Jan 2014 19:19:50 +0100

Thanks Lars. Good idea. It worked :)

2014-01-25 lars Folkestad <[email protected]>:
> Hi
> What if you merge the two files, and then use the _merge to identify what id's to keep and what do drop.
> Lars
>
>> Den 25/01/2014 kl. 16.50 skrev miriam geringer <[email protected]>:
>>
>> Hi Statalist,
>>
>> I have the following dataset:
>>
>> Identifier        Corresponding data
>> 1                    X
>> 2                    Z
>> 3                    D
>> 4
>> 4
>> 4
>> 5
>> 5
>> 5
>> 5
>> 6
>> 6
>> 6
>> 7
>> 8
>>
>> On the other hand, I have a *txt file, which includes only identifiers
>> that should be dropped from my dataset. A simple *txt including for
>> example:
>>
>> Identifier
>> 2
>> 3
>> 4
>>
>> Now, I want Stata to access this *txt file and drop all the
>> observations in the dataset (based on the Identifier) that are in this
>> specific *txt file. I know that I could just copy it into Stata, but
>> since the list is very long I would prefer an "external" link to this
>> file.
>>
>> After dropping, it should look like:
>>
>> Identifier        Corresponding data
>> 1                    X
>> 5
>> 5
>> 5
>> 5
>> 6
>> 6
>> 6
>> 7
>> 8
>>
>> Is something like this possible?
>>
>> Something like:
>> drop if identifier exists using C:/*txt
>>
>> Thanks!
>> *
>> *   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/
*
*   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