Actually, Brendan's expression will pick up values like "DC18" and
also "C1812". If Michael wants just single digits following the 18
(i.e. C180-C189) the following will work:
keep if regexm(site_02,"^C18[0-9]$")
-Steve
----- 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"
On Sep 19, 2007, at 8:25 AM, Brendan Halpin wrote:
Or use regular expressions: v
. keep if regexm(site_02,"C18[0-9]")
Steven JH Samuels
845-246-0774
18 Cantine's Island
Saugerties, NY 12477
EFax: 208-498-7441
*
* 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/