Announcement

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

  • Merging two datasets within the interval of dates

    Dear Stata Users,

    This post relates to the previous one, I was not clear enough on that. I need to merge "data1" to "data2" so that date in "data1", which is "facilitystartdate" lies between dates in "data2" which are "start" and "end". For that I used the follwing command:

    Code:
    use data2 
     rangejoin facilitystartdate start end using "D:\Research\date1.dta", by(lenderid)
    The problem is as follows. There are some "gvkey"s in data1 (for example: 1034, 1038, 1045, 1075.., etc.) that correspond to "lenderid"s that are in data2, but not in data1. So, I would assume that these gvkey should not appear in the merged sample. How come this is possible?

    I attach .csv (origninal files). Please, help me with this issue.



    Attached Files

  • #2
    This question was asked and addressed in the previous topic at https://www.statalist.org/forums/for...-certain-dates. If the answer there does not meet your needs, please improve your question in that topic.

    Comment


    • #3
      Thank you for the reply. The thing is that when I use small subsamples the results do hold. However, once I use the whole the sample I encounter the issue stated above.

      Comment


      • #4
        Please continue this discussion in the original topic.

        Comment

        Working...
        X