[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: another data cleaning question
At 08:46 23/06/02 -0700, Babigumira Ronnie wrote:
Use the -int- function (see -help functions-). In this case, you might type
I have data that looks like this
The first variable is the code for different crops while varcode is the
specific variety. As you can see from the example, the variety code comes
from crop code (the first three digits are the crop codes).
I am cleaning the data and I would like to flash out cases where the
varcode is not consistent with the cropcode such as
How can I do this in stata?
list if cropcod2!=cropcode
and Stata will generate a new variable -cropcod2-, which should be equal to
-cropcode- if the data are consistent. Stata will then list inconsistent
cases, and halt execution if there are any inconsistent cases, and drop the
variable -cropcod2- otherwise.
I hope this helps.
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
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
Opinions expressed are those of the author, not the institution.
* For searches and help try: