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


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: keep if string for more variables
Date   Tue, 10 Dec 2013 15:39:15 +0000

Should be

given a _string_ variable
Nick
njcoxstata@gmail.com


On 10 December 2013 15:38, Nick Cox <njcoxstata@gmail.com> wrote:
> What you typed is legal in Stata, given a variable whose name
> abbreviates to -color-,  but it will catch only
>
> "blue*"
>
> as a literal string which is the value of that string variable.
>
> You appear to want
>
> keep blue*
>
> which is a beast of a different colour (as we say in English).
>
> Nick
> njcoxstata@gmail.com
>
>
> On 10 December 2013 15:31, Nick Bornschein <nick.bornschein@gmail.com> 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/
*
*   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