Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Re: Stata Journal and piece of string variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Re: Stata Journal and piece of string variables
Date   Sat, 20 Nov 2004 18:09:43 -0000

drop if index(automob,"car") == (length(automob) - 2)

Nick 
n.j.cox@durham.ac.uk 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Nick Cox
> Sent: 20 November 2004 18:04
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: Re: Stata Journal and piece of string variables
> 
> 
> Scott Merryman suggested 
> 
> drop if substr(automob, -3 ,3) == "car"
> 
> and Michael Blasnik suggested 
>  
> drop if match(automob,"*car")
> 
> Yet another approach is 
> 
> drop if index(automob,"car") == (length(var1) - 2)
> 
> which is less direct than the other two. However, 
> in general, with string tasks, there are commonly 
> different ways to do it, and the basic string 
> functions documented at -whelp strfun- usually suffice. 
> 
> (I found that -help string- pointed me directly 
> to -strfun-.) 
> 

*
*   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