Announcement

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

  • Drop whole group of observations if one fulfils condition

    Dear all,

    I have a dataset with repeated values for variable id, say, id =[1 1 1 2 2 3 4 4 5 5 5] and for each observation a variable year that may be different for observations with the same id. Now I want to drop all observations with a certain value for id if one them has year<10. Can anyone help me out?

    Best,
    Marco

  • #2

    Code:
    bysort id (year) : drop if year[1] < 10

    Comment


    • #3
      Dear Nick,

      I also have the same issue (https://www.statalist.org/forums/for...ample-criteria), but this command removes one row (1989 in my case) not the firm.

      Can you please help me?

      Comment


      • #4
        Farid: I saw your original post and passed it by when I was busy and because you didn't give a data example to make it easy for people. Same comment still applies.

        Comment


        • #5
          Nick, I added a dataex example, i hope it suffices, if not please tell me what is missing to give a code that solves this issue.

          Comment

          Working...
          X