Announcement

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

  • Merging two Data-Sets Using a Range of Years

    Hello,
    I have two data-sets I would like to merge. The first data set is of elections, so each observation is at the state-year level. The second set is at the individual level. For each individual I see state she lives in and year of birth.

    I want to merge the data sets so that individuals would be linked elections. Specifically, I want an individual to be linked to an eleciton if the individual was 18-30 years old when the election took place. So the merging process would be over a set of years for every individual, and not over a specific year.

    Moreover the same individual may be linked via this process to more than one elections. In this case I want to link the individual only to the latest elections.


    How could I achieve this?

    Thank you very much.
    Last edited by Netane Ben-Porath; 14 Jun 2022, 03:11.

  • #2
    Search the forum for mentions of rangejoin from SSC, or look at the examples in the command's documentation.

    Code:
    ssc install rangejoin, replace
    help rangejoin
    If you are unable to make progress with this, provide a data example using the dataex command as outlined in FAQ Advice #12.


    Comment

    Working...
    X