Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • list when values of two integer values are unequal

    Hello Statalist,

    I am working with two integer variables with very similar values, "indly" and "ind":

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int indly
       0
       0
       0
       0
    6190
       0
       0
       0
       0
       0
       0
       0
    8770
    9160
       0
    8190
    5070
    8680
    2290
       0
       0
       0
       0
       0
       0
    7860
       0
       0
       0
     770
    5380
    4970
     270
       0
    7590
       0
       0
       0
       0
       0
       0
       0
       0
       0
       0
    7860
    9470
    7860
     270
    5680
     270
    7860
    7860
    7870
    7870
    3960
    8680
    8190
    8190
       0
    9480
    4670
       0
       0
    3970
     770
       0
       0
    3770
       0
       0
    8190
    7860
       0
    8190
       0
       0
       0
       0
    2980
     280
    7870
    1270
    1270
    8770
    3095
     770
       0
    5380
       0
       0
       0
    4870
    8470
       0
       0
       0
     570
       0
       0
    end
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int ind
       0
       0
       0
       0
    6190
       0
       0
       0
       0
       0
       0
       0
    4690
       0
       0
    8190
    5070
    8680
    2290
       0
       0
       0
       0
       0
       0
    6170
       0
       0
       0
    2180
    6990
    4970
     270
       0
    7590
       0
       0
       0
       0
       0
       0
       0
       0
       0
       0
    7860
    9470
    7860
     270
    5680
     270
    7860
    7860
    7870
    7870
    2290
    8680
    8190
    8190
       0
    9480
    4670
       0
       0
    7990
     770
       0
       0
    3770
       0
       0
    8190
    7860
       0
    5070
       0
       0
       0
       0
    2980
    3970
       0
    1270
    1270
    8770
    3095
     770
       0
    5380
       0
       0
       0
    4870
    8470
       0
       0
       0
     570
       0
       0
    end


    I would like Stata to list "indly" whenever it is unequal to "ind". So far, I have tried

    Code:
    list indly if != ind
    but am told "invalid name"; and

    Code:
    list indly if !== ind
    but am told "invalid syntax".

    Any suggestions?

    Best wishes,
    Rosa

  • #2

    Code:
    list indly  if indly != ind
    is legal, while typically
    Code:
    list indly ind if indly != ind
    would be even more useful. See
    Code:
    help operators
    to see that
    !== is not a supported operator.

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X