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

Re: st: RE: data cleaning


From   Babigumira Ronnie <rutaremwa_rb@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: data cleaning
Date   Thu, 20 Jun 2002 22:41:58 -0700 (PDT)

Many thanks Nick, I went for the first option and it worked just fine

egen OK = eqany(credsrc), values(111/114 211/236 311/321)

Best

Roni 

--- Nick Cox <n.j.cox@durham.ac.uk> wrote:
> Babigumira  Ronnie
> 
> > I am trying to clean some data here. The variable "credsrc" (credit
> > source) lies within 3 ranges 111-114 (for formal sources) or 211-236
> > (Microfinance) or 311-321 (informal sources). Can't seem to figure out
> the
> > logical syntax that will smoke out the illegal entries (such as >114
> but
> > <211, >236 but <311, >321). Someone please help me
> >
> > Variable would look something like this
> > Credsrc
> > 114
> > 112
> > 315
> > 214
> > 220
> > 318
> 
> I'll assume these are numeric not string codes. If not, -destring-.
> 
> Two possibilities:
> 
> egen OK = eqany(credsrc), values(111/114 211/236 311/321)
> 
> gen OK = inrange(credsrc,111,114) | inrange(credsrc,211,236) |
> inrange(credsrc,311,321)
> 
> list credsrc if !OK
> 
> Nick
> n.j.cox@durham.ac.uk
> 
> *
> *   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/


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index