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: How to check whether a string variable contains some characters


From   daniel klein <[email protected]>
To   [email protected]
Subject   Re: st: How to check whether a string variable contains some characters
Date   Sat, 26 May 2012 01:20:43 +0200

Bersant,

have a look at -help string functions-. You probably need something
like -strmatch()-. The code could look something like

. replace <varname> = <exp> if strmatch(<strvar>, "*GHMB*")

(although I guess you are looking for "GmbH" instead of "GHMB")

Better advice requires more information abut what _exactly_ you typed
and what _exactly_ Stata replied, as stated in the FAQ (which you are
asked to read before you post).

Note that in the example above there is no "if" command (which is most
often used in programs) but an -if- qualifier.

Best
Daniel

-- 
[...]
More specifically, if the firm name contains certain information, let say
the extension GHMB, I would infer that the firm is incorporated in
Germany. I am trying to use the "if" command to perform this operation
but I keep getting an error message.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index