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: Re: st: keep if string for more variables


From   Red Owl <[email protected]>
To   <[email protected]>
Subject   Re: Re: st: keep if string for more variables
Date   Tue, 10 Dec 2013 10:55:08 -0500

My suggestion below assumed you have a single string variable named
color with values blue01, blue02, yell0w01, etc.

If you have a set of binary variables for various colors, the solution
would be different.



> Red Owl <redowl@liu> wrote:
>
> Try:
>
> keep if substr(color,1,4)== "blue"
>
> Red Owl
> [email protected]


>> Nick Bornschein <[email protected]> wrote:

>> Hi,
>>
>> I have string variables, blue01 to blue10 and yellow01 to yellow10. I
want to keep some data by using:
>>
>>
>> keep if color == "blue*" to keep all blue data, but it does not work.
Any idea?
>>
>>
>> Thanks a lot
>> -Nick
*
*   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