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

Re: st: Using the -if- qualifier with a string variable


From   Roger Newson <[email protected]>
To   [email protected]
Subject   Re: st: Using the -if- qualifier with a string variable
Date   Sun, 03 Apr 2005 16:26:22 +0100

At 16:15 03/04/2005, Louis wrote:
Dear All,
Can the -if- qualifier be used with a string variable? If so, how is it done? I gave the following command, and had the shown result:
. keep if facility==bir
bir not found
r(111);

"facility" is a string variable and "bir" is one of the values "facility" takes.
You should type

keep if facility=="bir"

That way, Stata knows that "bir" is a string value. If you type

keep if facility==bir

then Stata will look for a string variable named bir, and will complain if it doesn't find it.

I hope this helps.

Roger






--
Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
Division of Asthma, Allergy and Lung Biology
King's College London

5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605
Email: [email protected]
Website: http://phs.kcl.ac.uk/rogernewson/

Opinions expressed are those of the author, not the institution.

*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index