Dear Statalist, I need your help for counting the number of others CITING family within a group of CITED family without duplicated obs. for a dataset of millions of obs. These counting need to fullfil three requirements:
Example: in the dataex below, the first CITING family (1037131) have two CITING firms (BERU and ELLER MARTIN), and none of them are in the “citedcompany” variable of the whole CITED family. Also, none of the two CITING firms are in the variable “citingcompany” of the other CITING family in the same year (2003). Therefore, the variable Count_t0 is 1 (there is only another CITING family with these conditions in the same citing_year). If any of the CITING firms (from this CITING family) are in the whole “citedcompany” (within the CITED family); or if any of these two CITING firms are in the list of CITING firms of the others CITING family (from the same year), then they will not count.
Count_t1 do the same but for the next year. That is, none of the two CITING firms (BERU and ELLER MARTIN) are in the “citedcompany” variable for the group of CITED family. And also, these two firms are neither in the “citingcompany” variable of the other CITING families but in the next year (2004). Since there are two other CITING families in 2004 with these conditions, then Count_t1 is 2 (this is for the case of the first CITING family).
For if it help, in the dataex you can see how these two "Count" variables must be.
I am really struggling with this.
Please, can you help me to build these two “Count” variables for this large dataset? It will be much appreciated!
- the CITING family must be different than the CITED family
- the CITING firms (citingcompany) of a given CITING family must to be different than the whole CITED firms group (citedcompany)
- the CITING firms (citingcompany) of a given CITING family must be different than the CITING firms of others CITING family in the same citing_year
Example: in the dataex below, the first CITING family (1037131) have two CITING firms (BERU and ELLER MARTIN), and none of them are in the “citedcompany” variable of the whole CITED family. Also, none of the two CITING firms are in the variable “citingcompany” of the other CITING family in the same year (2003). Therefore, the variable Count_t0 is 1 (there is only another CITING family with these conditions in the same citing_year). If any of the CITING firms (from this CITING family) are in the whole “citedcompany” (within the CITED family); or if any of these two CITING firms are in the list of CITING firms of the others CITING family (from the same year), then they will not count.
Count_t1 do the same but for the next year. That is, none of the two CITING firms (BERU and ELLER MARTIN) are in the “citedcompany” variable for the group of CITED family. And also, these two firms are neither in the “citingcompany” variable of the other CITING families but in the next year (2004). Since there are two other CITING families in 2004 with these conditions, then Count_t1 is 2 (this is for the case of the first CITING family).
For if it help, in the dataex you can see how these two "Count" variables must be.
I am really struggling with this.
Please, can you help me to build these two “Count” variables for this large dataset? It will be much appreciated!
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str36 citingcompany long(appln_nr pat_publn_id) str13 citing_publication str10 citing_pub_date int citing_year str19 citedcompany str10(cited_publication cited_pub_date) long(citing_family cited_family) byte(count_t0 count_t1) "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "GEISSINGER ALBRECHT" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "GEISSINGER ALBRECHT" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "LINDEMANN GERT" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "LINDEMANN GERT" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "KERN CHRISTOPH" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "KERN CHRISTOPH" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "OTTERBACH WOLFGANG" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "OTTERBACH WOLFGANG" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "HALUSCHKA CHRISTOPH" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "HALUSCHKA CHRISTOPH" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "REISSNER ANDREAS" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "REISSNER ANDREAS" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "LINDNER FRIEDERIKE" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "LINDNER FRIEDERIKE" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "ROBERT BOSCH" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "ROBERT BOSCH" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "BERU" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "DRESSLER WOLFGANG" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "ELLER MARTIN" 2002221414 288391687 "JP2003145229A" "20/05/2003" 2003 "DRESSLER WOLFGANG" "WO0116528" "08/03/2001" 1037131 1000065 1 2 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "ROBERT BOSCH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "ROBERT BOSCH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "ROBERT BOSCH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "ROBERT BOSCH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "DRESSLER WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "DRESSLER WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "DRESSLER WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 204584 286548117 "WO03064346A1" "07/08/2003" 2003 "DRESSLER WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "BOSSERT JOERG" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "GEISSINGER ALBRECHT" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "GEISSINGER ALBRECHT" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "BOSSERT JOERG" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "KERN CHRISTOPH" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "KERN CHRISTOPH" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "BOSSERT JOERG" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "SCHOTT STEFFEN" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "SCHOTT STEFFEN" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "BOSSERT JOERG" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "ROBERT BOSCH" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228076 284740316 "DE10228076A1" "08/01/2004" 2004 "ROBERT BOSCH" "WO0116529" "08/03/2001" 13038647 1000065 1 0 "BOSSERT JOERG" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "GEISSINGER ALBRECHT" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "GEISSINGER ALBRECHT" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "BOSSERT JOERG" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "KERN CHRISTOPH" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "KERN CHRISTOPH" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "BOSSERT JOERG" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "SCHOTT STEFFEN" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "SCHOTT STEFFEN" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "BOSSERT JOERG" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "ROBERT BOSCH" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "FRIEDRICH-SCHILLER-UNIVERSITAET JENA" 10228077 284740317 "DE10228077A1" "08/01/2004" 2004 "ROBERT BOSCH" "DE10020328" "01/03/2001" 13038648 1000065 1 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "GEISSINGER ALBRECHT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDEMANN GERT" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "KERN CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "OTTERBACH WOLFGANG" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "HALUSCHKA CHRISTOPH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "REISSNER ANDREAS" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "RIEDEL RALF" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "ROBERT BOSCH" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "LINDNER FRIEDERIKE" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "DRESSLER WOLFGANG" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "ROBERT BOSCH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 "KLONCZYNSKI ALEXANDER" 2794999 286548118 "EP1472197A1" "03/11/2004" 2004 "ROBERT BOSCH" "DE10020329" "22/03/2001" 9405455 1000065 0 0 end

Comment