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

Re: st: varlist


From   khigbee@stata.com
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: varlist
Date   Thu, 11 Jul 2002 08:00:11 -0500

Babigumira Ronnie <rutaremwa_rb@yahoo.com> asks:

> I have 3 variables percr100 percr200 percr300 (perennial crops grown), I
> know the range of these crops so I list illegal entries for percr100 using
> 
> egen perbc1 = eqany(percr100), v(-7 440/446 660/670 770/789)
> list houscode percr100 if !perbc1
> 
> then I look at the manual and eqany can be followed by varlist so instead
> of doing the above for all the three, I
> 
> egen perbc = eqany(percr100 percr200 percr300), v(-7 440/446 660/670
> 770/789)
> list houscode percr100 percr200 percr300 if !perbc
> 
> And the results are wrong, it appears that only the first variable was
> inspected. Did I just misinterpret eqany. In the event that I did (very
> likely) whats the way out

Can you show us an example of how the results were wrong?  Here
is a simple example I ran that worked just fine.

    . set obs 10
    obs was 0, now 10

    . gen a = _n

    . gen b = _n+2

    . gen c = _n+4

    . egen z = eqany(a b c) , values(1 4 9 12)

    . list

                 a          b          c         z
      1.         1          3          5         1
      2.         2          4          6         1
      3.         3          5          7         0
      4.         4          6          8         1
      5.         5          7          9         1
      6.         6          8         10         0
      7.         7          9         11         1
      8.         8         10         12         1
      9.         9         11         13         1
     10.        10         12         14         1

Ken Higbee    khigbee@stata.com
StataCorp     1-800-STATAPC

*
*   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