Announcement

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

  • Calculate an index.

    Dear All, Suppose that the data set is
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int(year times) long author
    2010  0 1
    2010  0 1
    2010  0 1
    2010  0 1
    2010  0 1
    2010  0 1
    2010  0 1
    2010  0 1
    2010  1 1
    2010  1 1
    2010  2 1
    2010  2 1
    2010 14 1
    2010  0 2
    2010  0 2
    2010  0 2
    2010  0 2
    2010  0 2
    2010  0 2
    2010  3 2
    2010  3 2
    2010  7 2
    2010  7 2
    2010 12 2
    2010 12 2
    2011  0 1
    2011  0 1
    2011  0 1
    2011  0 1
    2011  1 1
    2011  2 1
    2011  3 1
    2011  7 1
    2011  8 1
    2011 10 1
    2011  0 2
    2011  0 2
    2011  0 2
    2011  0 2
    2011  2 2
    2011  2 2
    2011  3 2
    2011  3 2
    2011  6 2
    2011  6 2
    end
    For each `author' and `year', I'd like to calculate an H index.
    1. For author=1 and year=2010, the number of the values of `times' greater than or equal to 1 is at least 1, then H=1. And The number of the values of `times' greater than or equal to 2 is at least 2, then H=2.
    2. For author=2 and year=2010, the number of the values of `times' greater than or equal to 1 is at least 1, then H=1. The number of the values of `times' greater than or equal to 2 is at least 2, then H=2. The number of the values of `times' greater than or equal to 3 is at least 3, then H=3. The number of the values of `times' greater than or equal to 4 is at least 4, then H=4, and so on. Any suggestions? Thanks.
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    River:
    I would go:
    Code:
    . forvalues i = 1/14  {
      2. replace aim_counter=`i' if times>=`i'
      3.  }
    
    . replace aim_counter=0 if aim_counter==. & times!=.
    
    
    .
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Is this covered by

      https://www.stata.com/statalist/arch.../msg00625.html

      https://www.statalist.org/forums/for...dex-with-stata

      ?

      Comment


      • #4
        Dear Carlo, Thanks for the suggestion.
        Ho-Chuan (River) Huang
        Stata 19.0, MP(4)

        Comment


        • #5
          Dear Nick, Yes, I think (Indeed, the question was asked by someone else) they are what I am looking for. Thanks.
          Ho-Chuan (River) Huang
          Stata 19.0, MP(4)

          Comment

          Working...
          X