Announcement

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

  • non-repetitive ratio?

    Dear All, I found this question here (in Chinese). The data set is:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str4 citing float year str4 cited
    "A" 2018 "C"
    "A" 2018 "D"
    "A" 2019 "C"
    "A" 2019 "F"
    "A" 2020 "E"
    "A" 2021 "B"
    "A" 2021 "C"
    "A" 2021 "D"
    end
    For each "citing" company (and assume there are many companies) and each "year", we'd like to obtain a non-repetitive ratio, which is explained below.
    For citing=A, and year=2021, there are three "cited" companies (B,C and D). One can find that only B does not appear in the previous 3 years. As a result, the non-repetitive ratio is 1/3 (for citing=A, and year=2021). Any suggestions? Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    maybe,
    Code:
    bysort citing cited (year): gen x = cited==cited[_n-1] & (year-year[_n-1])<=3
    bysort citing year: egen wanted = mean(x)
    replace wanted = 1 - wanted if wanted

    Comment


    • #3
      Dear Øyvind, Thanks a lot for this helpful suggestion.

      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment

      Working...
      X