Jason
see -help strfun- (help for string functions) and check out -index()-
This will return the position in the string of the first character of the
sought keyword or else 0 if the keyword does not exist within the
string. To turn this into a 0/1 dummy, you might
gen byte kw_found = index(stringvar, "keyword") > 0
where kw_found is the new 0/1 dummy variable and stringvar is the name of
the string variable in which you seek the occurrence of "keyword".
Phil
At 10:37 AM 10/02/2004 +1100, you wrote:
Dear all,
I too am relatively new at STATA, trying to find my way around the
differences in the syntax language from SPSS.
Anyway, I was wondering if there was a way in STATA syntax to search a
string variable for keywords and create an indicator variable (dummy)
where 1=keyword found and 0=keyword not found?
Thanks in advance,
Jason Payne
AUSTRALIA
____________________________________
Jason Payne
Violence, Property Crime and Drugs
Australian Institute of Criminology
GPO Box 2944 Canberra ACT 2601
E-mail: [email protected]
Tel +61 2 6260 9283 Fax +61 2 6260 9201
Visit the AIC homepage www.aic.gov.au
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
*
* 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/
Philip Ryan
Associate Professor,
Department of Public Health
Associate Dean (Information Technology)
Faculty of Health Sciences
University of Adelaide 5005
South Australia
tel 61 8 8303 3570
fax 61 8 8223 4075
http://www.public-health.adelaide.edu.au/
CRICOS Provider Number 00123M
-----------------------------------------------------------
This email message is intended only for the addressee(s)
and contains information that may be confidential and/or
copyright. If you are not the intended recipient please
notify the sender by reply email and immediately delete
this email. Use, disclosure or reproduction of this email
by anyone other than the intended recipient(s) is strictly
prohibited. No representation is made that this email or
any attachments are free of viruses. Virus scanning is
recommended and is the responsibility of the recipient.
*
* 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/