Announcement

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

  • A question about data processing.

    Hello, it's my first post in Statalist.Thank you for reading my post. I'd like to ask you a question.
    Here is a sample of my data:
    A B
    1 A01B
    0 A01B
    0 A01C
    0 A01C
    1 A01D
    1 A01D
    My question is, how can I keep the observations in B which contains both 1 and 0 in A, and drop the observations which contains only 0 or 1.(That is to say,how can I keep A01B, but drop A01C and A01D).
    Thank you very much!
    Last edited by Zhang Yangxun; 11 May 2018, 21:10.

  • #2
    Code:
    duplicates tag A B, generate(dup)
    drop if dup

    Comment


    • #3
      See also https://www.stata.com/support/faqs/d...ions-in-group/

      Comment


      • #4
        Thank you very much! :-)

        Comment

        Working...
        X