Announcement

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

  • How to check if IDs before/after one specific date are the same? if not, how do we know which ones are new or which ones dropped out?

    Hi everyone,

    I would like to know if the (separate) identifiers before and after June 1, 2021 are the same. And if not, I'd like to know which are new or which have been discontinued, please.

    I then would like to do a graph (bar, or hbar, or if you think about one more suitable to this, please go ahead with your suggestion!) that shows how many IDs are the same, how many dropped out, and how many jumped in, please.

    Here is a dataex:


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input long(id sp_zipcode) double(date_contract_start date_contract_end) float group
    1001  9200 18887 21700 0
    1001  9200 21701 22431 0
    1001  9200 22432 22645 1
    1001  9200 22646 22676 1
    1001  9200 22677 22735 1
    1001  9200 22736 23010 1
    1001  9200 23011 23069 1
    1001  9200 23070     . 1
    1005 48600 18800 21639 0
    1005 48600 21640 21651 0
    end
    format %td date_contract_start
    format %td date_contract_end

    -group- is a dummy variable (0/1):

    Code:
    bys id date_contract_start: gen group = date_contract_start >= mdy(6, 1, 2021)

    Thank you very much in advance.
    Best,

    Michael
    Last edited by Michael Duarte Goncalves; 20 Nov 2023, 07:45.

  • #2
    Any ideas please?

    Michael

    Comment

    Working...
    X