Statalist


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

Re: st: Re: global keys


From   Steven Samuels <sjhsamuels@earthlink.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: global keys
Date   Wed, 19 Sep 2007 11:44:40 -0400

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" <mm@pinest.org>

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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index