Statalist


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

Re: st: Re: global keys


From   Brendan Halpin <[email protected]>
To   [email protected]
Subject   Re: st: Re: global keys
Date   Wed, 19 Sep 2007 13:25:36 +0100

"Michael Blasnik" <[email protected]> writes:

> ----- Original Message ----- 
> From: "Michael McCulloch" <[email protected]>
>> Is there a less labor-intensive way to do the following:
>>
>> keep if site_02=="C180" |  site_02=="C181" |  site_02=="C182" |  ///
>> site_02=="C183" |  site_02=="C184" |  site_02=="C185" | ///
>> site_02=="C186" |  site_02=="C187" |  site_02=="C188" |
>> site_02=="C189"

> see help inlist()
>
> It only works with up to 10 strings (which your example exactly meets)

Or use regular expressions:

. keep if regexm(site_02,"C18[0-9]")

Brendan
-- 
Brendan Halpin,  Department of Sociology,  University of Limerick,  Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:[email protected]  http://www.ul.ie/sociology/brendan.halpin.html
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index