Dear Statalist, I really hope you can help me with this. I need to accumulate for each row the number of citations a patent receives (in a given year which is num_cit_yeart0) plus the number of citations of previous patents in the current year of analysis. These number of citations are done in several variables (in the dataex below it is done until t3 but I have until t30). For instance, num_cit_yeart0 is the number of citations a patent receives in the current year, while num_cit_yeart1 is the number of citations that same patent receives in the current + 1 year. So, while for a given firm in 1990, num_cit_yeart1 are the citations of that patent received in 1991, for another different firm in 2000, this same variable num_cit_yeart1 is the citations of that patent (2000) received in 2001.
That said, I need your help to build a variable that is the current number of citations for each firm-year (num_cit_yeart0), plus the number of citations of previous patents in the current year (num_cit_yeart1, num_cit_yeart2, num_cit_yeart3, ….). For instance, for firm 1977789 is clearer to see. In 2011 it has 4 citations. In 2012, the variable I need should be the current citations in 2012 (131) plus the citations from the patent in 2011 received in 2012 (4). In 2013 it should be its current citation (53) plus the ones from the patents in 2012 received in 2013 (30) plus the ones from the patent in 2011 received in 2013 (0), and so on.
However, it should be noted that some firms do not have a consecutive series of years. Check firm id 654184 that starts in 2000 and the next observations is in 2003.
I assume that this should be done in a loop, but I do not really have any clue or idea of how to start.
Any help will be more than appreciated!
That said, I need your help to build a variable that is the current number of citations for each firm-year (num_cit_yeart0), plus the number of citations of previous patents in the current year (num_cit_yeart1, num_cit_yeart2, num_cit_yeart3, ….). For instance, for firm 1977789 is clearer to see. In 2011 it has 4 citations. In 2012, the variable I need should be the current citations in 2012 (131) plus the citations from the patent in 2011 received in 2012 (4). In 2013 it should be its current citation (53) plus the ones from the patents in 2012 received in 2013 (30) plus the ones from the patent in 2011 received in 2013 (0), and so on.
However, it should be noted that some firms do not have a consecutive series of years. Check firm id 654184 that starts in 2000 and the next observations is in 2003.
I assume that this should be done in a loop, but I do not really have any clue or idea of how to start.
Any help will be more than appreciated!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long citing_firm_id strL citing_firm_name float(citing_year num_cit_yeart0 num_cit_yeart1 num_cit_yeart2 num_cit_yeart3) 441693 "MATSUSHITA ELECT IND CO LTD" 1979 0 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1980 3 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1981 37 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1982 16 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1983 65 0 0 0 441693 "MATSUSHITA ELECT CORP" 1984 43 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1985 101 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1986 134 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1987 147 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1988 175 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1989 310 2 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1990 433 0 2 1 441693 "MATSUSHITA ELECT IND CO LTD" 1991 561 0 3 0 441693 "MATSUSHITA ELECT IND CO LTD" 1992 761 1 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1993 734 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1994 847 1 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1995 766 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1996 768 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1997 1179 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1998 1236 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 1999 1677 0 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 2000 2993 2 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 2001 1801 1 0 1 441693 "PANASONIC CORP" 2002 1427 1 0 0 441693 "MATSUSHITA ELECT IND CO LTD" 2003 1360 0 0 0 441693 "PANASONIC CORP" 2004 1287 1 0 1 441693 "MATSUSHITA ELECT IND CO LTD" 2005 1101 0 0 0 441693 "PANASONIC CORP" 2006 901 0 1 0 441693 "MATSUSHITA ELECT IND CO LTD" 2007 859 1 0 0 441693 "PANASONIC CORP" 2008 687 0 0 0 441693 "PANASONIC CORP" 2009 617 0 0 0 441693 "PANASONIC CORP" 2010 1124 1 8 6 441693 "PANASONIC CORP" 2011 795 0 0 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2012 570 0 0 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2013 529 2 1 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2014 429 0 3 1 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2015 446 2 0 2 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2016 316 4 1 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2017 394 0 0 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2018 311 0 0 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2019 321 0 0 0 441693 "PANASONIC CORP" 2020 299 0 0 0 441693 "PANASONIC INTELLECTUAL PROPERTY MANAGEMENT CO LTD" 2021 76 0 0 0 654184 "DELTA ELECT INC" 2000 1 0 0 0 654184 "DELTA ELECT INC" 2003 0 0 0 0 654184 "DELTA ELECT INC" 2004 0 0 0 0 654184 "DELTA ELECT INC" 2005 1 0 0 0 654184 "DELTA ELECT INC" 2006 5 0 0 0 654184 "DELTA ELECT INC" 2007 2 0 0 0 654184 "DELTA ELECT INC" 2008 3 0 0 0 654184 "DELTA ELECT INC" 2009 3 0 0 0 654184 "DELTA ELECT INC" 2010 10 0 0 0 654184 "DELTA ELECT INC" 2011 7 0 0 0 654184 "DELTA ELECT INC" 2012 9 0 0 0 654184 "DELTA ELECT INC" 2013 12 0 0 0 654184 "DELTA ELECT INC" 2014 23 0 0 0 654184 "DELTA ELECT INC" 2015 17 0 0 0 654184 "DELTA ELECT INC" 2016 26 0 0 0 654184 "DELTA ELECT INC" 2017 11 0 0 0 654184 "DELTA ELECT INC" 2018 38 0 0 0 654184 "DELTA ELECT INC" 2019 17 0 0 0 654184 "DELTA ELECT INC" 2020 18 0 0 0 654184 "DELTA ELECT INC" 2021 11 0 0 0 1977789 "LSIS CO LTD" 2011 4 0 0 0 1977789 "LSIS CO LTD" 2012 131 30 0 8 1977789 "LSIS CO LTD" 2013 53 0 0 1 1977789 "LSIS CO LTD" 2014 54 0 1 0 1977789 "LSIS CO LTD" 2015 156 4 0 2 1977789 "LSIS CO LTD" 2016 103 1 1 0 1977789 "LSIS CO LTD" 2017 113 0 0 0 1977789 "LSIS CO LTD" 2018 56 0 0 0 1977789 "LSIS CO LTD" 2019 21 0 0 0 1977789 "LSIS CO LTD" 2020 12 0 0 0 2236495 "OMRON CORP" 1988 2 0 0 0 2236495 "OMRON CORP" 1989 22 0 0 0 2236495 "OMRON CORP" 1990 69 0 0 0 2236495 "OMRON CORP" 1991 54 2 0 0 2236495 "OMRON CORP" 1992 66 0 0 0 2236495 "OMRON CORP" 1993 30 0 0 0 2236495 "OMRON CORP" 1994 33 0 0 0 2236495 "OMRON CORP" 1995 76 0 0 0 2236495 "OMRON CORP" 1996 48 0 0 0 2236495 "OMRON CORP" 1997 40 0 0 0 2236495 "OMRON CORP" 1998 18 0 0 0 2236495 "OMRON CORP" 1999 34 0 0 0 2236495 "OMRON CORP" 2000 27 0 0 0 2236495 "OMRON CORP" 2001 47 2 1 0 2236495 "OMRON CORP" 2002 42 0 0 0 2236495 "OMRON CORP" 2003 54 0 0 0 2236495 "OMRON CORP" 2004 114 0 0 0 2236495 "OMRON CORP" 2005 62 0 0 0 2236495 "OMRON CORP" 2006 101 0 0 1 2236495 "OMRON CORP" 2007 69 0 0 0 2236495 "OMRON CORP" 2008 64 0 0 0 2236495 "OMRON CORP" 2009 26 0 0 0 2236495 "OMRON CORP" 2010 51 0 7 0 2236495 "OMRON CORP" 2011 32 7 0 0 2236495 "OMRON CORP" 2012 39 2 0 0 2236495 "OMRON CORP" 2013 92 2 15 10 2236495 "OMRON CORP" 2014 109 2 1 0 end

Comment