NOTE: Copyright (c) 2025 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M9)
      Licensed to SMU T&R UTOF 2024-018380 EAS WX6, Site 70305237.
NOTE: This session is executing on the X64_WIN+PRO  platform.



NOTE: Analytical products:

      SAS/STAT 15.4
      SAS/ETS 15.4
      SAS/OR 15.4
      SAS/IML 15.4
      SAS/QC 15.4

NOTE: Additional host information:

 X64_WIN+PRO WIN 10.0.26100  Workstation

NOTE: SAS initialization used:
      real time           2.27 seconds
      cpu time            1.24 seconds

1    proc import out=pat_kpss
1  ! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\KPSS_2022.csv"
1  ! dbms=csv replace; run; *3160453;

2     /**********************************************************************
3     *   PRODUCT:   SAS
4     *   VERSION:   9.4
5     *   CREATOR:   External File Interface
6     *   DATE:      11JUN26
7     *   DESC:      Generated SAS Datastep Code
8     *   TEMPLATE SOURCE:  (None Specified.)
9     ***********************************************************************/
10       data WORK.PAT_KPSS    ;
11       %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
12       infile 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\KPSS_2022.csv'
12 ! delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
13          informat patent_num best32. ;
14          informat permno best32. ;
15          informat issue_date best32. ;
16          informat filing_date best32. ;
17          informat xi_nominal best32. ;
18          informat xi_real best32. ;
19          informat cites best32. ;
20          format patent_num best12. ;
21          format permno best12. ;
22          format issue_date best12. ;
23          format filing_date best12. ;
24          format xi_nominal best12. ;
25          format xi_real best12. ;
26          format cites best12. ;
27       input
28                   patent_num
29                   permno
30                   issue_date
31                   filing_date
32                   xi_nominal
33                   xi_real
34                   cites
35       ;
36       if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
36 ! */
37       run;

NOTE: The infile 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\KPSS_2022.csv' is:
      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\KPSS_2022.csv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=225671661,
      Last Modified=30,May,2024 10:50:53,
      Create Time=11,June,2026 15:50:55

NOTE: 3160453 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\KPSS_2022.csv'.
      The minimum record length was 41.
      The maximum record length was 74.
NOTE: The data set WORK.PAT_KPSS has 3160453 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           1.37 seconds
      cpu time            1.29 seconds


3160453 rows created in WORK.PAT_KPSS from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\KPSS_2022.csv.



NOTE: WORK.PAT_KPSS data set was successfully created.
NOTE: The data set WORK.PAT_KPSS has 3160453 observations and 7 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           1.74 seconds
      cpu time            1.42 seconds


38   proc import out=uspto_patinv1
38 ! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_inventor_disambigua
38 ! ted.tsv" dbms=TAB replace; run; *21197038;

39    /**********************************************************************
40    *   PRODUCT:   SAS
41    *   VERSION:   9.4
42    *   CREATOR:   External File Interface
43    *   DATE:      11JUN26
44    *   DESC:      Generated SAS Datastep Code
45    *   TEMPLATE SOURCE:  (None Specified.)
46    ***********************************************************************/
47       data WORK.USPTO_PATINV1    ;
48       %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
49       infile
49 ! 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_inventor_disambiguated.tsv'
49 ! delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
50          informat patent_id $10. ;
51          informat inventor_sequence best32. ;
52          informat inventor_id $27. ;
53          informat disambig_inventor_name_first $13. ;
54          informat disambig_inventor_name_last $13. ;
55          informat gender_code $3. ;
56          informat location_id $38. ;
57          format patent_id $10. ;
58          format inventor_sequence best12. ;
59          format inventor_id $27. ;
60          format disambig_inventor_name_first $13. ;
61          format disambig_inventor_name_last $13. ;
62          format gender_code $3. ;
63          format location_id $38. ;
64       input
65                   patent_id  $
66                   inventor_sequence
67                   inventor_id  $
68                   disambig_inventor_name_first  $
69                   disambig_inventor_name_last  $
70                   gender_code  $
71                   location_id  $
72       ;
73       if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
73 ! */
74       run;

NOTE: The infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_inventor_disambiguated.tsv'
       is:

      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_inventor_disambigua
      ted.tsv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=2025092416,
      Last Modified=21,August,2023 20:34:32,
      Create Time=11,June,2026 15:50:53

NOTE: 21197038 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_inventor_disambiguated.tsv'
      .
      The minimum record length was 44.
      The maximum record length was 201.
NOTE: The data set WORK.USPTO_PATINV1 has 21197038 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           10.52 seconds
      cpu time            10.26 seconds


21197038 rows created in WORK.USPTO_PATINV1 from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_inventor_disambiguated.tsv.



NOTE: WORK.USPTO_PATINV1 data set was successfully created.
NOTE: The data set WORK.USPTO_PATINV1 has 21197038 observations and 7 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           10.71 seconds
      cpu time            10.32 seconds


75   proc import out=uspto_loc1
75 ! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_location_disambigua
75 ! ted.tsv" dbms=TAB replace; run; *90730;

76    /**********************************************************************
77    *   PRODUCT:   SAS
78    *   VERSION:   9.4
79    *   CREATOR:   External File Interface
80    *   DATE:      11JUN26
81    *   DESC:      Generated SAS Datastep Code
82    *   TEMPLATE SOURCE:  (None Specified.)
83    ***********************************************************************/
84       data WORK.USPTO_LOC1    ;
85       %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
86       infile
86 ! 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_location_disambiguated.tsv'
86 ! delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
87          informat location_id $38. ;
88          informat disambig_city $17. ;
89          informat disambig_state $4. ;
90          informat disambig_country $4. ;
91          informat latitude best32. ;
92          informat longitude best32. ;
93          informat county $21. ;
94          informat state_fips $4. ;
95          informat county_fips $5. ;
96          format location_id $38. ;
97          format disambig_city $17. ;
98          format disambig_state $4. ;
99          format disambig_country $4. ;
100         format latitude best12. ;
101         format longitude best12. ;
102         format county $21. ;
103         format state_fips $4. ;
104         format county_fips $5. ;
105      input
106                  location_id  $
107                  disambig_city  $
108                  disambig_state  $
109                  disambig_country  $
110                  latitude
111                  longitude
112                  county  $
113                  state_fips  $
114                  county_fips  $
115      ;
116      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
116! */
117      run;

NOTE: The infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_location_disambiguated.tsv'
       is:

      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_location_disambigua
      ted.tsv,
      RECFM=V,LRECL=32767,File Size (bytes)=8630655,
      Last Modified=09,August,2023 01:50:36,
      Create Time=11,June,2026 15:51:11

NOTE: 90730 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_location_disambiguated.tsv'
      .
      The minimum record length was 73.
      The maximum record length was 147.
NOTE: The data set WORK.USPTO_LOC1 has 90730 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.10 seconds
      cpu time            0.09 seconds


90730 rows created in WORK.USPTO_LOC1 from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_location_disambiguated.tsv.



NOTE: WORK.USPTO_LOC1 data set was successfully created.
NOTE: The data set WORK.USPTO_LOC1 has 90730 observations and 9 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.21 seconds
      cpu time            0.13 seconds


118  proc import out=uspto_patasg1
118! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_assignee_disambigua
118! ted.tsv" dbms=TAB replace; run; *7849158;

Name "disambig_assignee_individual_name_first" truncated to disambig_assignee_individual_na.
Name "disambig_assignee_individual_name_last" truncated to disambig_assignee_individual_na.
Name disambig_assignee_individual_na is a duplicate.
Problems were detected with provided names.  See LOG.
119   /**********************************************************************
120   *   PRODUCT:   SAS
121   *   VERSION:   9.4
122   *   CREATOR:   External File Interface
123   *   DATE:      11JUN26
124   *   DESC:      Generated SAS Datastep Code
125   *   TEMPLATE SOURCE:  (None Specified.)
126   ***********************************************************************/
127      data WORK.USPTO_PATASG1    ;
128      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
129      infile
129! 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_assignee_disambiguated.tsv'
129! delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
130         informat patent_id $10. ;
131         informat assignee_sequence best32. ;
132         informat assignee_id $38. ;
133         informat disambig_assignee_individual_na $2. ;
134         informat VAR5 $2. ;
135         informat disambig_assignee_organization $62. ;
136         informat assignee_type best32. ;
137         informat location_id $38. ;
138         format patent_id $10. ;
139         format assignee_sequence best12. ;
140         format assignee_id $38. ;
141         format disambig_assignee_individual_na $2. ;
142         format VAR5 $2. ;
143         format disambig_assignee_organization $62. ;
144         format assignee_type best12. ;
145         format location_id $38. ;
146      input
147                  patent_id  $
148                  assignee_sequence
149                  assignee_id  $
150                  disambig_assignee_individual_na  $
151                  VAR5  $
152                  disambig_assignee_organization  $
153                  assignee_type
154                  location_id  $
155      ;
156      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
156! */
157      run;

NOTE: The infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_assignee_disambiguated.tsv'
       is:

      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_assignee_disambigua
      ted.tsv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=992341318,
      Last Modified=27,September,2023 20:51:38,
      Create Time=11,June,2026 15:51:16

NOTE: 7849158 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_assignee_disambiguated.tsv'
      .
      The minimum record length was 10.
      The maximum record length was 346.
NOTE: The data set WORK.USPTO_PATASG1 has 7849158 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           4.77 seconds
      cpu time            4.75 seconds


7849158 rows created in WORK.USPTO_PATASG1 from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_assignee_disambiguated.tsv.



NOTE: WORK.USPTO_PATASG1 data set was successfully created.
NOTE: The data set WORK.USPTO_PATASG1 has 7849158 observations and 8 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           4.87 seconds
      cpu time            4.81 seconds


158  proc import out=uspto_cite
158! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_us_patent_citation.
158! tsv" dbms=TAB replace; run; *  133954965;

159   /**********************************************************************
160   *   PRODUCT:   SAS
161   *   VERSION:   9.4
162   *   CREATOR:   External File Interface
163   *   DATE:      11JUN26
164   *   DESC:      Generated SAS Datastep Code
165   *   TEMPLATE SOURCE:  (None Specified.)
166   ***********************************************************************/
167      data WORK.USPTO_CITE    ;
168      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
169      infile
169! 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_us_patent_citation.tsv'
169! delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
170         informat patent_id $10. ;
171         informat citation_sequence best32. ;
172         informat citation_patent_id $9. ;
173         informat citation_date $12. ;
174         informat record_name $17. ;
175         informat wipo_kind $4. ;
176         informat citation_category $20. ;
177         format patent_id $10. ;
178         format citation_sequence best12. ;
179         format citation_patent_id $9. ;
180         format citation_date $12. ;
181         format record_name $17. ;
182         format wipo_kind $4. ;
183         format citation_category $20. ;
184      input
185                  patent_id  $
186                  citation_sequence
187                  citation_patent_id  $
188                  citation_date  $
189                  record_name  $
190                  wipo_kind  $
191                  citation_category  $
192      ;
193      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
193! */
194      run;

NOTE: The infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_us_patent_citation.tsv' is:

      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_us_patent_citation.
      tsv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=9450116373,
      Last Modified=07,August,2023 06:04:38,
      Create Time=11,June,2026 15:51:18

NOTE: 133954965 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_us_patent_citation.tsv'.
      The minimum record length was 28.
      The maximum record length was 130.
NOTE: The data set WORK.USPTO_CITE has 133954965 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           52.37 seconds
      cpu time            51.61 seconds


133954965 rows created in WORK.USPTO_CITE from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_us_patent_citation.tsv.



NOTE: WORK.USPTO_CITE data set was successfully created.
NOTE: The data set WORK.USPTO_CITE has 133954965 observations and 7 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           52.48 seconds
      cpu time            51.68 seconds


195  proc import out=uspto_pat
195! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_application.tsv"
195! dbms=TAB replace; run; *8515205;

196   /**********************************************************************
197   *   PRODUCT:   SAS
198   *   VERSION:   9.4
199   *   CREATOR:   External File Interface
200   *   DATE:      11JUN26
201   *   DESC:      Generated SAS Datastep Code
202   *   TEMPLATE SOURCE:  (None Specified.)
203   ***********************************************************************/
204      data WORK.USPTO_PAT    ;
205      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
206      infile 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_application.tsv'
206! delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
207         informat application_id $10. ;
208         informat patent_id $10. ;
209         informat patent_application_type $4. ;
210         informat filing_date $12. ;
211         informat series_code $4. ;
212         informat rule_47_flag best32. ;
213         format application_id $10. ;
214         format patent_id $10. ;
215         format patent_application_type $4. ;
216         format filing_date $12. ;
217         format series_code $4. ;
218         format rule_47_flag best12. ;
219      input
220                  application_id  $
221                  patent_id  $
222                  patent_application_type  $
223                  filing_date  $
224                  series_code  $
225                  rule_47_flag
226      ;
227      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
227! */
228      run;

NOTE: The infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_application.tsv' is:
      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_application.tsv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=393140616,
      Last Modified=03,August,2023 20:54:34,
      Create Time=11,June,2026 15:51:13

NOTE: 8515205 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_application.tsv'.
      The minimum record length was 42.
      The maximum record length was 46.
NOTE: The data set WORK.USPTO_PAT has 8515205 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           2.84 seconds
      cpu time            2.79 seconds


8515205 rows created in WORK.USPTO_PAT from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_application.tsv.



NOTE: WORK.USPTO_PAT data set was successfully created.
NOTE: The data set WORK.USPTO_PAT has 8515205 observations and 6 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           2.94 seconds
      cpu time            2.87 seconds


229  proc sql;
229!            *21197038;
230      create table patinvloc as select distinct
231      a.*, b.*
232      from uspto_patinv1 as a left join uspto_loc1 as b
233      on a.location_id = b.location_id ;
WARNING: Variable location_id already exists on file WORK.PATINVLOC.
NOTE: Table WORK.PATINVLOC created, with 21197038 rows and 15 columns.

234      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           33.01 seconds
      cpu time            57.71 seconds


235  run; * 21197038;
236  data patinvloc1;
237  set patinvloc;
238  nr_pt = patent_id + 0;
239  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      238:9
NOTE: Invalid numeric data, patent_id='D242583' , at line 238 column 9.
patent_id=D242583 inventor_sequence=0 inventor_id=fl:le_ln:knight-6
disambig_inventor_name_first=Lewis Charles disambig_inventor_name_last=Knight gender_code=M
location_id=  disambig_city=  disambig_state=  disambig_country=  latitude=. longitude=.
county=  state_fips=  county_fips=  nr_pt=. _ERROR_=1 _N_=19717496
NOTE: Invalid numeric data, patent_id='D242584' , at line 238 column 9.
patent_id=D242584 inventor_sequence=0 inventor_id=fl:ja_ln:kaufman-1
disambig_inventor_name_first=Jack W. disambig_inventor_name_last=Kaufman gender_code=M
location_id=0d054244-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Merrick disambig_state=NY
disambig_country=US latitude=40.6628796 longitude=-73.551516 county=Nassau state_fips=36
county_fips=059 nr_pt=. _ERROR_=1 _N_=19717497
NOTE: Invalid numeric data, patent_id='D242585' , at line 238 column 9.
patent_id=D242585 inventor_sequence=0 inventor_id=fl:ja_ln:kaufman-1
disambig_inventor_name_first=Jack W. disambig_inventor_name_last=Kaufman gender_code=M
location_id=0d054244-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Merrick disambig_state=NY
disambig_country=US latitude=40.6628796 longitude=-73.551516 county=Nassau state_fips=36
county_fips=059 nr_pt=. _ERROR_=1 _N_=19717498
NOTE: Invalid numeric data, patent_id='D242586' , at line 238 column 9.
patent_id=D242586 inventor_sequence=0 inventor_id=fl:ja_ln:kaufman-1
disambig_inventor_name_first=Jack W. disambig_inventor_name_last=Kaufman gender_code=M
location_id=0d054244-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Merrick disambig_state=NY
disambig_country=US latitude=40.6628796 longitude=-73.551516 county=Nassau state_fips=36
county_fips=059 nr_pt=. _ERROR_=1 _N_=19717499
NOTE: Invalid numeric data, patent_id='D242587' , at line 238 column 9.
patent_id=D242587 inventor_sequence=0 inventor_id=fl:wi_ln:sklaroff-1
disambig_inventor_name_first=William disambig_inventor_name_last=Sklaroff gender_code=M
location_id=0e418846-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Levittown disambig_state=PA
disambig_country=US latitude=40.1541257 longitude=-74.8408768 county=Bucks state_fips=42
county_fips=017 nr_pt=. _ERROR_=1 _N_=19717500
NOTE: Invalid numeric data, patent_id='D242588' , at line 238 column 9.
patent_id=D242588 inventor_sequence=0 inventor_id=m6jgoibgwder3dj0bs4otedv4
disambig_inventor_name_first=Edouard disambig_inventor_name_last=Hewak gender_code=M
location_id=16b3c6f8-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Chartres disambig_state=
disambig_country=FR latitude=48.4438601 longitude=1.4881434 county=  state_fips=
county_fips=  nr_pt=. _ERROR_=1 _N_=19717501
NOTE: Invalid numeric data, patent_id='D242589' , at line 238 column 9.
patent_id=D242589 inventor_sequence=0 inventor_id=fl:jo_ln:leto-2
disambig_inventor_name_first=Joseph disambig_inventor_name_last=Leto gender_code=M
location_id=e33aaf88-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Cambridge disambig_state=WI
disambig_country=US latitude=43.0036122 longitude=-89.0164995 county=Jefferson state_fips=55
county_fips=055 nr_pt=. _ERROR_=1 _N_=19717502
NOTE: Invalid numeric data, patent_id='D242590' , at line 238 column 9.
patent_id=D242590 inventor_sequence=0 inventor_id=fl:wi_ln:sklaroff-1
disambig_inventor_name_first=William disambig_inventor_name_last=Sklaroff gender_code=M
location_id=0e418846-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Levittown disambig_state=PA
disambig_country=US latitude=40.1541257 longitude=-74.8408768 county=Bucks state_fips=42
county_fips=017 nr_pt=. _ERROR_=1 _N_=19717503
NOTE: Invalid numeric data, patent_id='D242591' , at line 238 column 9.
patent_id=D242591 inventor_sequence=0 inventor_id=fl:do_ln:hurd-3
disambig_inventor_name_first=Donald Leroy disambig_inventor_name_last=Hurd gender_code=M
location_id=c23328eb-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Montebello disambig_state=CA
disambig_country=US latitude=34.0159398 longitude=-118.111975 county=Los Angeles
state_fips=06 county_fips=037 nr_pt=. _ERROR_=1 _N_=19717504
NOTE: Invalid numeric data, patent_id='D242592' , at line 238 column 9.
patent_id=D242592 inventor_sequence=0 inventor_id=fl:gr_ln:gabourie-1
disambig_inventor_name_first=Gregory S. disambig_inventor_name_last=Gabourie gender_code=M
location_id=7ea6431b-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Ajax disambig_state=ON
disambig_country=CA latitude=43.8505287 longitude=-79.0208814 county=  state_fips=
county_fips=  nr_pt=. _ERROR_=1 _N_=19717505
NOTE: Invalid numeric data, patent_id='D242593' , at line 238 column 9.
patent_id=D242593 inventor_sequence=0 inventor_id=u4klynr9dfu7cj0gyvbq7g5i5
disambig_inventor_name_first=James R. disambig_inventor_name_last=Sterkel gender_code=M
location_id=c2e24e95-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Rancho Santa Fe
disambig_state=CA disambig_country=US latitude=33.0203211 longitude=-117.202813
county=San Diego state_fips=06 county_fips=073 nr_pt=. _ERROR_=1 _N_=19717506
NOTE: Invalid numeric data, patent_id='D242594' , at line 238 column 9.
patent_id=D242594 inventor_sequence=0 inventor_id=fl:wa_ln:monson-1
disambig_inventor_name_first=Wallace A. disambig_inventor_name_last=Monson gender_code=M
location_id=d4add821-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Jackson disambig_state=MN
disambig_country=US latitude=43.6207916 longitude=-94.9886022 county=Jackson state_fips=27
county_fips=063 nr_pt=. _ERROR_=1 _N_=19717507
NOTE: Invalid numeric data, patent_id='D242595' , at line 238 column 9.
patent_id=D242595 inventor_sequence=0 inventor_id=fl:fr_ln:delise-3
disambig_inventor_name_first=Frank C. disambig_inventor_name_last=De Lise gender_code=M
location_id=094f8720-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Nissequogue disambig_state=NY
disambig_country=US latitude=40.9039869 longitude=-73.1978899 county=Suffolk state_fips=36
county_fips=103 nr_pt=. _ERROR_=1 _N_=19717508
NOTE: Invalid numeric data, patent_id='D242595' , at line 238 column 9.
patent_id=D242595 inventor_sequence=1 inventor_id=fl:st_ln:delise-1
disambig_inventor_name_first=Stephen W. disambig_inventor_name_last=De Lise gender_code=M
location_id=07e4f6c2-16c8-11ed-9b5f-1234bde3cd05 disambig_city=West Islip disambig_state=NY
disambig_country=US latitude=40.7058564 longitude=-73.3077301 county=Suffolk state_fips=36
county_fips=103 nr_pt=. _ERROR_=1 _N_=19717509
NOTE: Invalid numeric data, patent_id='D242596' , at line 238 column 9.
patent_id=D242596 inventor_sequence=0 inventor_id=fl:do_ln:munson-1
disambig_inventor_name_first=Donald disambig_inventor_name_last=Munson gender_code=M
location_id=c31f40f3-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Apple Valley disambig_state=CA
disambig_country=US latitude=34.5008311 longitude=-117.1858759 county=San Bernardino
state_fips=06 county_fips=071 nr_pt=. _ERROR_=1 _N_=19717510
NOTE: Invalid numeric data, patent_id='D242597' , at line 238 column 9.
patent_id=D242597 inventor_sequence=0 inventor_id=fl:ab_ln:gamus-1
disambig_inventor_name_first=Abe disambig_inventor_name_last=Gamus gender_code=M
location_id=a8c9fcf3-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Laval disambig_state=QC
disambig_country=CA latitude=45.5757802 longitude=-73.7530656 county=  state_fips=
county_fips=  nr_pt=. _ERROR_=1 _N_=19717511
NOTE: Invalid numeric data, patent_id='D242598' , at line 238 column 9.
patent_id=D242598 inventor_sequence=0 inventor_id=fl:er_ln:kunstlicher-1
disambig_inventor_name_first=Erich disambig_inventor_name_last=Kunstlicher gender_code=M
location_id=  disambig_city=  disambig_state=  disambig_country=  latitude=. longitude=.
county=  state_fips=  county_fips=  nr_pt=. _ERROR_=1 _N_=19717512
NOTE: Invalid numeric data, patent_id='D242599' , at line 238 column 9.
patent_id=D242599 inventor_sequence=0 inventor_id=fl:ja_ln:plummer-4
disambig_inventor_name_first=James E. disambig_inventor_name_last=Plummer gender_code=M
location_id=1ac6f5d6-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Toledo disambig_state=OH
disambig_country=US latitude=41.6529143 longitude=-83.5378173 county=Lucas state_fips=39
county_fips=095 nr_pt=. _ERROR_=1 _N_=19717513
NOTE: Invalid numeric data, patent_id='D242600' , at line 238 column 9.
patent_id=D242600 inventor_sequence=0 inventor_id=fl:th_ln:box-1
disambig_inventor_name_first=Theodor M. disambig_inventor_name_last=Box gender_code=M
location_id=0c4c7aa3-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Brielle disambig_state=NJ
disambig_country=US latitude=40.1078931 longitude=-74.0565263 county=Monmouth state_fips=34
county_fips=025 nr_pt=. _ERROR_=1 _N_=19717514
NOTE: Invalid numeric data, patent_id='D242601' , at line 238 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=D242601 inventor_sequence=0 inventor_id=fl:yo_ln:sato-87
disambig_inventor_name_first=Yo disambig_inventor_name_last=Sato gender_code=M location_id=
disambig_city=  disambig_state=  disambig_country=  latitude=. longitude=. county=
state_fips=  county_fips=  nr_pt=. _ERROR_=1 _N_=19717515
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1479543 at 238:19
NOTE: There were 21197038 observations read from the data set WORK.PATINVLOC.
NOTE: The data set WORK.PATINVLOC1 has 21197038 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           5.02 seconds
      cpu time            4.70 seconds


239!      * 21197038;
240  data pat_kpss_clean;
241  set pat_kpss;
242  grantdate =Input(Put(issue_date, 8.), Yymmdd10.);
243  filedate = Input(Put(filing_date, 8.), Yymmdd10.);
244  format grantdate filedate date9.;
245  drop issue_date filing_date;
246  run;

NOTE: There were 3160453 observations read from the data set WORK.PAT_KPSS.
NOTE: The data set WORK.PAT_KPSS_CLEAN has 3160453 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.72 seconds
      cpu time            0.71 seconds


246!      *3090902;
247  proc sql;
247!            *3090902;
248      create table cpatinvloc as select distinct
249      a.patent_num as nr_pt, a.*, b.location_id, b.disambig_city as city, b.disambig_state
249!  as state, b.disambig_country as country, b.county, b.state_fips, b.county_fips,
249! b.latitude, b.longitude
250      from pat_kpss_clean as a left join patinvloc1 as b
251      on a.patent_num = b.nr_pt;
NOTE: Table WORK.CPATINVLOC created, with 6107173 rows and 17 columns.

252      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           13.95 seconds
      cpu time            23.42 seconds


253  run; *6107173;
254  *isolate patents that are by 1 firm; *we can be sure that the inventor is working for
254! the Compustat assignee;
255  proc sql;
255!            *7849158;
256      create table casg_1firm as select distinct
257      patent_id, assignee_id
258      from uspto_patasg1 ;
NOTE: Table WORK.CASG_1FIRM created, with 7843731 rows and 2 columns.

259      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           4.35 seconds
      cpu time            6.57 seconds


260  run; *7843731 patent with multiple same assignee but different location;
261  PROC SQL;
262      CREATE TABLE casg_1firm1  AS
263      SELECT DISTINCT *, count(patent_id) as num_assignee
264      FROM casg_1firm
265      group BY patent_id;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CASG_1FIRM1 created, with 7843731 rows and 3 columns.

266  QUIT;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.28 seconds
      cpu time            3.73 seconds


266!        *7843731 ;
267  data casg_1firm2;
268  set casg_1firm1;
269  if num_assignee =1;
270  nr_pt = patent_id +0;
271  if not missing(nr_pt);
272  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      270:9
NOTE: Invalid numeric data, patent_id='ADMINISTRA' , at line 270 column 9.
patent_id=ADMINISTRA assignee_id=fe1dd7c7-16c7-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235063
NOTE: Invalid numeric data, patent_id='AGRONOMIQU' , at line 270 column 9.
patent_id=AGRONOMIQU assignee_id=173808ad-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235067
NOTE: Invalid numeric data, patent_id='APPLIANCES' , at line 270 column 9.
patent_id=APPLIANCES assignee_id=67999b0e-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235068
NOTE: Invalid numeric data, patent_id='ARID TROPI' , at line 270 column 9.
patent_id=ARID TROPI assignee_id=37579623-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235073
NOTE: Invalid numeric data, patent_id='Academia C' , at line 270 column 9.
patent_id=Academia C assignee_id=6d731d5e-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235074
NOTE: Invalid numeric data, patent_id='America. I' , at line 270 column 9.
patent_id=America. I assignee_id=c8ea0862-16c7-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235077
NOTE: Invalid numeric data, patent_id='BARCELONA' , at line 270 column 9.
patent_id=BARCELONA assignee_id=1d3ee21b-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235078
NOTE: Invalid numeric data, patent_id='BIOLOGICAL' , at line 270 column 9.
patent_id=BIOLOGICAL assignee_id=3b444e27-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235079
NOTE: Invalid numeric data, patent_id='BRANCH"' , at line 270 column 9.
patent_id=BRANCH" assignee_id=13e81279-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235080
NOTE: Invalid numeric data, patent_id='BUILDING P' , at line 270 column 9.
patent_id=BUILDING P assignee_id=0ae5dbad-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235081
NOTE: Invalid numeric data, patent_id='BY GUARANT' , at line 270 column 9.
patent_id=BY GUARANT assignee_id=6aa02d92-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235082
NOTE: Invalid numeric data, patent_id='Biology"' , at line 270 column 9.
patent_id=Biology" assignee_id=8a6e68e9-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235083
NOTE: Invalid numeric data, patent_id='Biotechnol' , at line 270 column 9.
patent_id=Biotechnol assignee_id=843f4caa-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235084
NOTE: Invalid numeric data, patent_id='CENTER"' , at line 270 column 9.
patent_id=CENTER" assignee_id=93778f03-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235085
NOTE: Invalid numeric data, patent_id='COMMERCE C' , at line 270 column 9.
patent_id=COMMERCE C assignee_id=67999b0e-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235102
NOTE: Invalid numeric data, patent_id='COMPANY LI' , at line 270 column 9.
patent_id=COMPANY LI assignee_id=3575c473-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235103
NOTE: Invalid numeric data, patent_id='COMPANY"' , at line 270 column 9.
patent_id=COMPANY" assignee_id=8aac712a-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235104
NOTE: Invalid numeric data, patent_id='Co. Ltd."' , at line 270 column 9.
patent_id=Co. Ltd." assignee_id=3ada708f-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235114
NOTE: Invalid numeric data, patent_id='Commodity' , at line 270 column 9.
patent_id=Commodity assignee_id=3575c473-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235127
NOTE: Invalid numeric data, patent_id='Corporatio' , at line 270 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=Corporatio assignee_id=696f80f0-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235128
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      594157 at 270:19
NOTE: There were 7843731 observations read from the data set WORK.CASG_1FIRM1.
NOTE: The data set WORK.CASG_1FIRM2 has 6738255 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.73 seconds
      cpu time            0.71 seconds


272!      *6738255;
273  **merge with cpatinvloc;
274  proc sql;
274!            *6738255;
275      create table cpatinvloc_1firm as select distinct
276      a.nr_pt, b.*
277      from casg_1firm2 as a left join cpatinvloc as b
278      on a.nr_pt = b.nr_pt;
WARNING: Variable nr_pt already exists on file WORK.CPATINVLOC_1FIRM.
NOTE: Table WORK.CPATINVLOC_1FIRM created, with 9586923 rows and 17 columns.

279      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           8.70 seconds
      cpu time            14.67 seconds


280  run; *9586923;
281  data cpatinvloc_1firm1;
282  set cpatinvloc_1firm ;
283  if not missing(permno);
284  drop patent_num;
285  run;

NOTE: There were 9586923 observations read from the data set WORK.CPATINVLOC_1FIRM.
NOTE: The data set WORK.CPATINVLOC_1FIRM1 has 5341898 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           1.09 seconds
      cpu time            1.07 seconds


285!      * 5341898;
286  data cpatinvloc_1firm2;
287  set cpatinvloc_1firm1;
288  if country = "US";
289  run;

NOTE: There were 5341898 observations read from the data set WORK.CPATINVLOC_1FIRM1.
NOTE: The data set WORK.CPATINVLOC_1FIRM2 has 3628928 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           0.64 seconds
      cpu time            0.59 seconds


289!      *3628928;
290  **cites;
291  proc sql;
291!            * 133954965;
292      create table pat_cite as select distinct
293      a.citation_patent_id as patent_id, a.patent_id as citf_patent_id, b.filing_date as
293! date_filing_citf
294      from uspto_cite as a left join uspto_pat as b
295      on a.patent_id = b.patent_id;
NOTE: Table WORK.PAT_CITE created, with 133709407 rows and 3 columns.

296      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:29.83
      cpu time            2:18.48


297  run; * 133709407;
298  data pat_cite1;
299  set pat_cite;
300  patent_num = patent_id +0;
301  if not missing(patent_num);
302  drop patent_id;
303  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      300:14
NOTE: Invalid numeric data, patent_id='$974592' , at line 300 column 14.
patent_id=$974592 citf_patent_id=D350822 date_filing_citf=1993-02-24 patent_num=. _ERROR_=1
_N_=1
NOTE: Invalid numeric data, patent_id=''799989' , at line 300 column 14.
patent_id='799989 citf_patent_id=4875965 date_filing_citf=1987-10-30 patent_num=. _ERROR_=1
_N_=2
NOTE: Invalid numeric data, patent_id=''935893' , at line 300 column 14.
patent_id='935893 citf_patent_id=4881996 date_filing_citf=1988-02-22 patent_num=. _ERROR_=1
_N_=3
NOTE: Invalid numeric data, patent_id='/45663' , at line 300 column 14.
patent_id=/45663 citf_patent_id=5575226 date_filing_citf=1994-08-05 patent_num=. _ERROR_=1
_N_=8
NOTE: Invalid numeric data, patent_id='0 279 588' , at line 300 column 14.
patent_id=0 279 588 citf_patent_id=6541811 date_filing_citf=2001-06-12 patent_num=. _ERROR_=1
_N_=9
NOTE: Invalid numeric data, patent_id='0 540 245' , at line 300 column 14.
patent_id=0 540 245 citf_patent_id=6612679 date_filing_citf=2001-12-28 patent_num=. _ERROR_=1
_N_=10
NOTE: Invalid numeric data, patent_id='0 588 414' , at line 300 column 14.
patent_id=0 588 414 citf_patent_id=6368064 date_filing_citf=2000-12-01 patent_num=. _ERROR_=1
_N_=11
NOTE: Invalid numeric data, patent_id='0 599 420' , at line 300 column 14.
patent_id=0 599 420 citf_patent_id=6431274 date_filing_citf=2000-06-23 patent_num=. _ERROR_=1
_N_=12
NOTE: Invalid numeric data, patent_id='0 599 423' , at line 300 column 14.
patent_id=0 599 423 citf_patent_id=6431274 date_filing_citf=2000-06-23 patent_num=. _ERROR_=1
_N_=13
NOTE: Invalid numeric data, patent_id='0 646 658' , at line 300 column 14.
patent_id=0 646 658 citf_patent_id=6711531 date_filing_citf=1999-08-09 patent_num=. _ERROR_=1
_N_=14
NOTE: Invalid numeric data, patent_id='0 646 810' , at line 300 column 14.
patent_id=0 646 810 citf_patent_id=6788066 date_filing_citf=2001-01-16 patent_num=. _ERROR_=1
_N_=15
NOTE: Invalid numeric data, patent_id='0000H94' , at line 300 column 14.
patent_id=0000H94 citf_patent_id=4881813 date_filing_citf=1988-05-20 patent_num=. _ERROR_=1
_N_=20
NOTE: Invalid numeric data, patent_id='07/511229' , at line 300 column 14.
patent_id=07/511229 citf_patent_id=5372135 date_filing_citf=1994-03-21 patent_num=. _ERROR_=1
_N_=443
NOTE: Invalid numeric data, patent_id='07/511341' , at line 300 column 14.
patent_id=07/511341 citf_patent_id=5372135 date_filing_citf=1994-03-21 patent_num=. _ERROR_=1
_N_=444
NOTE: Invalid numeric data, patent_id='07/527514' , at line 300 column 14.
patent_id=07/527514 citf_patent_id=5372135 date_filing_citf=1994-03-21 patent_num=. _ERROR_=1
_N_=445
NOTE: Invalid numeric data, patent_id='07/725441' , at line 300 column 14.
patent_id=07/725441 citf_patent_id=5372135 date_filing_citf=1994-03-21 patent_num=. _ERROR_=1
_N_=446
NOTE: Invalid numeric data, patent_id='07/725502' , at line 300 column 14.
patent_id=07/725502 citf_patent_id=5372135 date_filing_citf=1994-03-21 patent_num=. _ERROR_=1
_N_=447
NOTE: Invalid numeric data, patent_id='07/806144' , at line 300 column 14.
patent_id=07/806144 citf_patent_id=5372135 date_filing_citf=1994-03-21 patent_num=. _ERROR_=1
_N_=448
NOTE: Invalid numeric data, patent_id='07/852478' , at line 300 column 14.
patent_id=07/852478 citf_patent_id=5185331 date_filing_citf=1991-05-14 patent_num=. _ERROR_=1
_N_=449
NOTE: Invalid numeric data, patent_id='08/381048' , at line 300 column 14.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=08/381048 citf_patent_id=5563245 date_filing_citf=1995-01-31 patent_num=. _ERROR_=1
_N_=493
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      11566990 at 300:24
NOTE: There were 133709407 observations read from the data set WORK.PAT_CITE.
NOTE: The data set WORK.PAT_CITE1 has 122142417 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           9.92 seconds
      cpu time            9.50 seconds


303!      *122142417;
304  proc sql;
304!            *3090902;
305      create table pat_kpss_cite as select distinct
306      a.*, b.*
307      from pat_kpss_clean as a left join pat_cite1 as b
308      on a.patent_num = b.patent_num;
WARNING: Variable patent_num already exists on file WORK.PAT_KPSS_CITE.
NOTE: Table WORK.PAT_KPSS_CITE created, with 47302475 rows and 9 columns.

309      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:06.20
      cpu time            1:27.03


310  run; *47302475;
311  data pat_kpss_cite1;
312  set pat_kpss_cite;
313  citf_patent_num = citf_patent_id +0;
314  if not missing(citf_patent_num);
315  citf_date_filing = Input(Put(date_filing_citf, 10.), Yymmdd10.);
316  format citf_date_filing  date9.;
317  drop citf_patent_id date_filing_citf;
318  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      313:19
NOTE: Invalid numeric data, citf_patent_id='D276032' , at line 313 column 19.
patent_num=1571008 permno=10786 xi_nominal=0.0292879138 xi_real=0.1614971971 cites=4
grantdate=26JAN1926 filedate=03MAY1922 citf_patent_id=D276032 date_filing_citf=1981-12-28
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=36
NOTE: Invalid numeric data, citf_patent_id='RE29831' , at line 313 column 19.
patent_num=1571192 permno=15341 xi_nominal=0.0288652511 xi_real=0.1591665822 cites=0
grantdate=02FEB1926 filedate=20MAR1925 citf_patent_id=RE29831 date_filing_citf=1977-05-13
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=51
NOTE: Invalid numeric data, citf_patent_id='RE31386' , at line 313 column 19.
patent_num=1571192 permno=15341 xi_nominal=0.0288652511 xi_real=0.1591665822 cites=0
grantdate=02FEB1926 filedate=20MAR1925 citf_patent_id=RE31386 date_filing_citf=1980-11-25
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=52
NOTE: Invalid numeric data, citf_patent_id='D682651' , at line 313 column 19.
patent_num=1571550 permno=11164 xi_nominal=0.0199361283 xi_real=0.1099302892 cites=0
grantdate=02FEB1926 filedate=03JAN1922 citf_patent_id=D682651 date_filing_citf=2012-05-14
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=106
NOTE: Invalid numeric data, citf_patent_id='D682652' , at line 313 column 19.
patent_num=1571550 permno=11164 xi_nominal=0.0199361283 xi_real=0.1099302892 cites=0
grantdate=02FEB1926 filedate=03JAN1922 citf_patent_id=D682652 date_filing_citf=2012-05-14
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=107
NOTE: Invalid numeric data, citf_patent_id='D724923' , at line 313 column 19.
patent_num=1571550 permno=11164 xi_nominal=0.0199361283 xi_real=0.1099302892 cites=0
grantdate=02FEB1926 filedate=03JAN1922 citf_patent_id=D724923 date_filing_citf=2013-04-29
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=108
NOTE: Invalid numeric data, citf_patent_id='D750461' , at line 313 column 19.
patent_num=1571550 permno=11164 xi_nominal=0.0199361283 xi_real=0.1099302892 cites=0
grantdate=02FEB1926 filedate=03JAN1922 citf_patent_id=D750461 date_filing_citf=2015-01-30
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=109
NOTE: Invalid numeric data, citf_patent_id='D343759' , at line 313 column 19.
patent_num=1572682 permno=12060 xi_nominal=1.061757976 xi_real=5.8546654496 cites=0
grantdate=09FEB1926 filedate=05AUG1925 citf_patent_id=D343759 date_filing_citf=1991-07-30
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=203
NOTE: Invalid numeric data, citf_patent_id='RE29293' , at line 313 column 19.
patent_num=1572943 permno=15421 xi_nominal=0.5667253787 xi_real=3.1249941784 cites=5
grantdate=16FEB1926 filedate=22NOV1920 citf_patent_id=RE29293 date_filing_citf=1975-05-20
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=245
NOTE: Invalid numeric data, citf_patent_id='D794562' , at line 313 column 19.
patent_num=1573641 permno=12079 xi_nominal=0.9308219997 xi_real=5.1326682018 cites=7
grantdate=16FEB1926 filedate=26MAY1923 citf_patent_id=D794562 date_filing_citf=2015-05-18
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=323
NOTE: Invalid numeric data, citf_patent_id='D827572' , at line 313 column 19.
patent_num=1573641 permno=12079 xi_nominal=0.9308219997 xi_real=5.1326682018 cites=7
grantdate=16FEB1926 filedate=26MAY1923 citf_patent_id=D827572 date_filing_citf=2015-03-31
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=324
NOTE: Invalid numeric data, citf_patent_id='D985309' , at line 313 column 19.
patent_num=1573826 permno=15368 xi_nominal=0.209934617 xi_real=1.1576055716 cites=2
grantdate=23FEB1926 filedate=29JUN1921 citf_patent_id=D985309 date_filing_citf=2019-02-01
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=337
NOTE: Invalid numeric data, citf_patent_id='D363148' , at line 313 column 19.
patent_num=1574578 permno=12060 xi_nominal=0.6563416367 xi_real=3.6191493641 cites=11
grantdate=23FEB1926 filedate=19APR1924 citf_patent_id=D363148 date_filing_citf=1994-12-19
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=397
NOTE: Invalid numeric data, citf_patent_id='D968523' , at line 313 column 19.
patent_num=1574998 permno=15368 xi_nominal=0.0307324558 xi_real=0.169462581 cites=1
grantdate=02MAR1926 filedate=27SEP1922 citf_patent_id=D968523 date_filing_citf=2020-12-04
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=463
NOTE: Invalid numeric data, citf_patent_id='D347104' , at line 313 column 19.
patent_num=1576350 permno=12503 xi_nominal=0.4154706292 xi_real=2.2909566899 cites=2
grantdate=09MAR1926 filedate=04AUG1925 citf_patent_id=D347104 date_filing_citf=1992-09-29
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=572
NOTE: Invalid numeric data, citf_patent_id='D302145' , at line 313 column 19.
patent_num=1576555 permno=11965 xi_nominal=0.0846262205 xi_real=0.4666394986 cites=2
grantdate=16MAR1926 filedate=28APR1923 citf_patent_id=D302145 date_filing_citf=1986-08-15
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=582
NOTE: Invalid numeric data, citf_patent_id='D373102' , at line 313 column 19.
patent_num=1578076 permno=12431 xi_nominal=0.2165384393 xi_real=1.1940198689 cites=1
grantdate=23MAR1926 filedate=06JUL1922 citf_patent_id=D373102 date_filing_citf=1994-11-01
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=687
NOTE: Invalid numeric data, citf_patent_id='D937907' , at line 313 column 19.
patent_num=1578526 permno=15368 xi_nominal=0.0355420895 xi_real=0.195983499 cites=1
grantdate=30MAR1926 filedate=31MAR1920 citf_patent_id=D937907 date_filing_citf=2019-10-09
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=742
NOTE: Invalid numeric data, citf_patent_id='D486728' , at line 313 column 19.
patent_num=1578634 permno=10401 xi_nominal=0.1693917243 xi_real=0.934047022 cites=21
grantdate=30MAR1926 filedate=31JUL1925 citf_patent_id=D486728 date_filing_citf=2001-07-12
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=769
NOTE: Invalid numeric data, citf_patent_id='D511679' , at line 313 column 19.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_num=1578634 permno=10401 xi_nominal=0.1693917243 xi_real=0.934047022 cites=21
grantdate=30MAR1926 filedate=31JUL1925 citf_patent_id=D511679 date_filing_citf=2003-09-09
citf_patent_num=. citf_date_filing=. _ERROR_=1 _N_=770
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1750359 at 313:34
NOTE: Mathematical operations could not be performed at the following places. The results of
      the operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      34 at 315:20
NOTE: There were 47302475 observations read from the data set WORK.PAT_KPSS_CITE.
NOTE: The data set WORK.PAT_KPSS_CITE1 has 45552116 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           9.24 seconds
      cpu time            8.14 seconds


318!      *4552116;
319  proc sql;
319!            *4552116;
320      create table pat_kpss_cite1a as select distinct
321      a.*, b.permno as citf_permno
322      from pat_kpss_cite1 as a left join pat_kpss_clean as b
323      on a.citf_patent_num = b.patent_num having permno ^= citf_permno;
NOTE: Table WORK.PAT_KPSS_CITE1A created, with 39205429 rows and 10 columns.

324      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           51.09 seconds
      cpu time            1:21.59


325  run; *39205429;
326  data cite_ns3;
327  set pat_kpss_cite1a;
328  win3 = intnx('year', grantdate, 3, 's');
329  if not missing(grantdate) and  citf_date_filing >= grantdate and citf_date_filing < win3
329!  then cit3 =1;
330  if cit3 =1;
331  run;

NOTE: There were 39205429 observations read from the data set WORK.PAT_KPSS_CITE1A.
NOTE: The data set WORK.CITE_NS3 has 6333581 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           11.89 seconds
      cpu time            11.79 seconds


331!       *6333581;
332  proc sql;
333      create table pcite_ns3 as select distinct
334      patent_num as nr_pt, count(patent_num) as ncite_ns3
335      from cite_ns3
336  GROUP BY nr_pt;
NOTE: Table WORK.PCITE_NS3 created, with 1357812 rows and 2 columns.

337  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.58 seconds
      cpu time            1.34 seconds


338  run; *1357812;
339  *merge cpatinvloc_1firm1 with pcite_ns3;
340  proc sql;
340!            *3628928;
341      create table cinv3_nom as select distinct
342      a.*, b.*
343      from cpatinvloc_1firm2 as a left join pcite_ns3 as b
344      on a.nr_pt = b.nr_pt having country = "US";
WARNING: Variable nr_pt already exists on file WORK.CINV3_NOM.
NOTE: Table WORK.CINV3_NOM created, with 3628928 rows and 17 columns.

345      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           4.40 seconds
      cpu time            6.87 seconds


346  run; *3628928;
347  data cinv3_nom1;
348  set cinv3_nom;
349  if missing(ncite_ns3) then ncite_ns3 =0;
350  cfips = state_fips*1000+county_fips;
351  keep nr_pt permno xi_nominal xi_real cites grantdate filedate cfips ncite_ns3;
352  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      350:9    350:25
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      2349 at 350:19
NOTE: There were 3628928 observations read from the data set WORK.CINV3_NOM.
NOTE: The data set WORK.CINV3_NOM1 has 3628928 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.45 seconds
      cpu time            0.45 seconds


352!      *3628928;
353  proc sql;
353!            *3628928;
354      create table cinv3_nom2 as select distinct
355      *, mean(cites) as mncite_yr
356      from cinv3_nom1
357      group by year(filedate)
358      ;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CINV3_NOM2 created, with 2777209 rows and 10 columns.

359      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.00 seconds
      cpu time            3.65 seconds


360  run; *2777209;
361  data cinvf_nom;
362  set cinv3_nom2;
363  ncite_ns3tr =ncite_ns3/mncite_yr;
364  ncitetr = cites/mncite_yr;
365  if mncite_yr =0 then ncite_ns3tr = 0;
366  if mncite_yr =0 then ncitetr = 0;
367  run;

NOTE: Division by zero detected at line 363 column 23.
NOTE: Division by zero detected at line 364 column 16.
nr_pt=4156108 permno=10401 xi_nominal=8.6031198065 xi_real=10.947385829 cites=0
grantdate=22MAY1979 filedate=31JAN1947 ncite_ns3=0 cfips=36061 mncite_yr=0 ncite_ns3tr=0
ncitetr=0 _ERROR_=1 _N_=87424
NOTE: Division by zero detected at line 363 column 23.
NOTE: Division by zero detected at line 364 column 16.
nr_pt=6201846 permno=77699 xi_nominal=6.7994294215 xi_real=3.7556554134 cites=0
grantdate=13MAR2001 filedate=31MAR1947 ncite_ns3=0 cfips=10005 mncite_yr=0 ncite_ns3tr=0
ncitetr=0 _ERROR_=1 _N_=768022
NOTE: Mathematical operations could not be performed at the following places. The results of
      the operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      2 at 363:23   2 at 364:16
NOTE: There were 2777209 observations read from the data set WORK.CINV3_NOM2.
NOTE: The data set WORK.CINVF_NOM has 2777209 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.23 seconds
      cpu time            0.23 seconds


368  libname sas "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\sas working files";
NOTE: Libref SAS was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\sas working files
369  libname comp "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\compustat";
NOTE: Libref COMP was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\compustat
370  data sas.pcite_ns3_kpss;
371  set pcite_ns3;
372  run;

NOTE: There were 1357812 observations read from the data set WORK.PCITE_NS3.
NOTE: The data set SAS.PCITE_NS3_KPSS has 1357812 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.06 seconds
      cpu time            0.04 seconds


373  data comp;
374  set comp.compa_1970_2020;
375  if fyear >= 1985;
376  keep gvkey datadate fyear;
377  run;

NOTE: There were 493152 observations read from the data set COMP.COMPA_1970_2020.
NOTE: The data set WORK.COMP has 395681 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           7.19 seconds
      cpu time            2.23 seconds


377!      *395681;
378  proc sql;
379    create table comp1 as
380    select a.*, b.lpermno as permno
381    from comp as a, comp.ccmxpf_lnkhist as b
382    where a.gvkey=b.gvkey and b.linkprim in ('P', 'C') and
383    b.LINKTYPE in ('LU', 'LC') and
384    a.datadate >= b.LINKDT and (a.datadate <= b.LINKENDDT or missing(b.LINKENDDT))
385    order by gvkey, datadate;
NOTE: Table WORK.COMP1 created, with 230931 rows and 4 columns.

386  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.28 seconds
      cpu time            0.26 seconds


386!       *230931;
387  proc sql;
387!           *230931;
388      create table comp_lagdate as select distinct
389      a.*, b.datadate as lagdatadate
390      from comp1 as a left join comp as b
391      on a.gvkey = b.gvkey and a.fyear = b.fyear+1;
NOTE: Table WORK.COMP_LAGDATE created, with 230931 rows and 5 columns.

392      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.19 seconds
      cpu time            0.29 seconds


392!           *230931;
393  data comp_lagdate1;
394  set comp_lagdate;
395  if lagdatadate =. then lagdatadate = intnx('month', datadate,-12, 'E');
396  gvkey1 = gvkey + 0;
397  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      396:10
NOTE: There were 230931 observations read from the data set WORK.COMP_LAGDATE.
NOTE: The data set WORK.COMP_LAGDATE1 has 230931 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


397!      *230931;
398  proc sql;
398!           *230931;
399      create table ccinvfnm as select distinct
400      a.*, b.*
401      from comp_lagdate1 as a left join cinvf_nom as b
402      on a.permno = b.permno and b.filedate > a.lagdatadate and b.filedate <= a.datadate;
WARNING: Variable permno already exists on file WORK.CCINVFNM.
NOTE: Table WORK.CCINVFNM created, with 2628164 rows and 17 columns.

403      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.44 seconds
      cpu time            5.57 seconds


404  run; * 2628164;
405  proc sql;
405!           * 2628164;
406      create table ccinvfnm1 as select distinct
407      gvkey, fyear, datadate, cfips, count(nr_pt) as numpat, sum(ncite_ns3) as tncite_ns3,
407!  mean(ncite_ns3) as mncite_ns3, sum(cites) as tncite, mean(cites) as mncite,
408      sum(ncite_ns3tr) as tncite_ns3tr, mean(ncite_ns3tr) as mncite_ns3tr, sum(ncitetr) as
408!  tncitetr, mean(ncitetr) as mncitetr, sum(xi_real) as txir, mean(xi_real) as mxir,
408! sum(xi_nominal) as txin, mean(xi_nominal) as mxin
409      from ccinvfnm
410  group by gvkey, fyear, cfips;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CCINVFNM1 created, with 578470 rows and 17 columns.

411      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.78 seconds
      cpu time            3.37 seconds


412  run; *578470;
413  data sas.ccinvfnm1_ext;
414  set ccinvfnm1;
415  run;

NOTE: There were 578470 observations read from the data set WORK.CCINVFNM1.
NOTE: The data set SAS.CCINVFNM1_EXT has 578470 observations and 17 variables.
NOTE: DATA statement used (Total process time):
      real time           0.07 seconds
      cpu time            0.07 seconds


416  data sas.ccinvfnm_ext;
417  set ccinvfnm;
418  run;

NOTE: There were 2628164 observations read from the data set WORK.CCINVFNM.
NOTE: The data set SAS.CCINVFNM_EXT has 2628164 observations and 17 variables.
NOTE: DATA statement used (Total process time):
      real time           0.34 seconds
      cpu time            0.35 seconds


419  PROC EXPORT DATA= sas.ccinvfnm1_ext
420      OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
420! files\ccinvfnm_ext.dta"
421      DBMS=STATA REPLACE;
422      RUN;

NOTE: The export data set has 578470 observations and 17 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\ccinvfnm_ext.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.19 seconds
      cpu time            0.14 seconds


423  PROC EXPORT DATA= comp
424              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
424! files\comp.dta"
425              DBMS=STATA REPLACE;
426      RUN;

NOTE: The export data set has 395681 observations and 3 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working files\comp.dta" file
      was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.01 seconds


427  PROC EXPORT DATA= comp1
428      OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
428! files\comp_permno_1985s.dta"
429      DBMS=STATA REPLACE;
430      RUN;

NOTE: The export data set has 230931 observations and 4 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\comp_permno_1985s.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


431  PROC EXPORT DATA= uspto_patasg1
432      OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\assignee.dta"
433      DBMS=STATA REPLACE;
434      RUN;

NOTE: The export data set has 7849158 observations and 8 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\assignee.dta" file was
      successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           2.80 seconds
      cpu time            2.65 seconds


435  **subfirm patents;
436  proc import out=subfirms
436! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
436! files\subfirms_fips2.dta" dbms=dta replace; run; *115;

NOTE: One or more variables were converted because the data type is not supported by the V9
      engine. For more details, run with options MSGLEVEL=I.
NOTE: The import data set has 115 observations and 7 variables.
NOTE: WORK.SUBFIRMS data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


437  proc sql;
438      create table comp_subfirms as select distinct
439      a.gvkey, a.datadate, a.lagdatadate, a.fyear, b.*
440      from comp_lagdate1 as a left join subfirms as b
441      on a.gvkey1 = b.gvkey;
WARNING: Variable gvkey already exists on file WORK.COMP_SUBFIRMS.
NOTE: Table WORK.COMP_SUBFIRMS created, with 230931 rows and 10 columns.

442      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.29 seconds
      cpu time            0.53 seconds


443  run; * 395681; *230931;
444  proc sql;
445      create table comp_subfirms_permno as select distinct
446      a.*, b.*
447      from comp_subfirms as a left join comp1 as b
448      on a.gvkey = b.gvkey and a.fyear = b.fyear;
WARNING: Variable GVKEY already exists on file WORK.COMP_SUBFIRMS_PERMNO.
WARNING: Variable DATADATE already exists on file WORK.COMP_SUBFIRMS_PERMNO.
WARNING: Variable FYEAR already exists on file WORK.COMP_SUBFIRMS_PERMNO.
NOTE: Table WORK.COMP_SUBFIRMS_PERMNO created, with 230931 rows and 11 columns.

449      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.49 seconds
      cpu time            0.65 seconds


450  run; * 395681; *230931;
451  proc sql;
452      create table comp_pat_kpss as select distinct
453      a.*, b.*
454      from comp_subfirms_permno as a left join pat_kpss_clean as b
455      on a.permno = b.permno and b.filedate > a.lagdatadate and b.filedate <= a.datadate;
WARNING: Variable permno already exists on file WORK.COMP_PAT_KPSS.
NOTE: Table WORK.COMP_PAT_KPSS created, with 2401538 rows and 17 columns.

456      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           5.80 seconds
      cpu time            9.56 seconds


457  run; *2566288; *2401538;
458  proc sql;
458!           *2566288;
459      create table comp_npat_kpss as select distinct
460      gvkey, datadate, fyear, ssub_total, tsub_split, sic_subsidy, count(patent_num) as
460! numpat
461      from comp_pat_kpss
462      group by gvkey, fyear;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.COMP_NPAT_KPSS created, with 230931 rows and 7 columns.

463      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.15 seconds
      cpu time            2.17 seconds


464  run; * 395681; *230931;
465  PROC EXPORT DATA= comp_npat_kpss
466              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
466! files\comp_npat_kpss.dta"
467              DBMS=STATA REPLACE;
468      RUN;

NOTE: The export data set has 230931 observations and 7 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\comp_npat_kpss.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.04 seconds


469  **************;
470  *patent class to calculate tech closeness;
471  data cinv_ext;
472  set sas.ccinvfnm_ext;
473  run;

NOTE: There were 2628164 observations read from the data set SAS.CCINVFNM_EXT.
NOTE: The data set WORK.CINV_EXT has 2628164 observations and 17 variables.
NOTE: DATA statement used (Total process time):
      real time           0.39 seconds
      cpu time            0.36 seconds


473!      *2628164;
474  data cinv_ext_pat;
475  set cinv_ext;
476  keep gvkey cfips fyear nr_pt grantdate filedate;
477  run;

NOTE: There were 2628164 observations read from the data set WORK.CINV_EXT.
NOTE: The data set WORK.CINV_EXT_PAT has 2628164 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.28 seconds
      cpu time            0.26 seconds


477!      *2628164;
478  proc import out=uspc
478! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_uspc_at_issue.tsv"
478! dbms=tab replace; run; *20796039;

479   /**********************************************************************
480   *   PRODUCT:   SAS
481   *   VERSION:   9.4
482   *   CREATOR:   External File Interface
483   *   DATE:      11JUN26
484   *   DESC:      Generated SAS Datastep Code
485   *   TEMPLATE SOURCE:  (None Specified.)
486   ***********************************************************************/
487      data WORK.USPC    ;
488      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
489      infile
489! 'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_uspc_at_issue.tsv'
489! delimiter='09'x MISSOVER DSD lrecl=32767 firstobs=2 ;
490         informat patent_id $9. ;
491         informat uspc_sequence best32. ;
492         informat uspc_mainclass_id $5. ;
493         informat uspc_mainclass_title $156. ;
494         informat uspc_subclass_id $9. ;
495         informat uspc_subclass_title $105. ;
496         format patent_id $9. ;
497         format uspc_sequence best12. ;
498         format uspc_mainclass_id $5. ;
499         format uspc_mainclass_title $156. ;
500         format uspc_subclass_id $9. ;
501         format uspc_subclass_title $105. ;
502      input
503                  patent_id  $
504                  uspc_sequence
505                  uspc_mainclass_id  $
506                  uspc_mainclass_title  $
507                  uspc_subclass_id  $
508                  uspc_subclass_title  $
509      ;
510      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable
510! */
511      run;

NOTE: The infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_uspc_at_issue.tsv' is:
      Filename=C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_uspc_at_issue.tsv,
      RECFM=V,LRECL=32767,
      File Size (bytes)=2094411657,
      Last Modified=05,September,2023 21:14:46,
      Create Time=11,June,2026 15:51:20

NOTE: 20796039 records were read from the infile
      'C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_uspc_at_issue.tsv'.
      The minimum record length was 27.
      The maximum record length was 601.
NOTE: The data set WORK.USPC has 20796039 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           11.11 seconds
      cpu time            10.73 seconds


20796039 rows created in WORK.USPC from
C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\patent\g_uspc_at_issue.tsv.



NOTE: WORK.USPC data set was successfully created.
NOTE: The data set WORK.USPC has 20796039 observations and 6 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           11.38 seconds
      cpu time            10.82 seconds


512  *merge with uspc data;
513  data uspc1;
514  set uspc;
515  nr_pt = patent_id +0;
516  if not missing(nr_pt);
517  rename uspc_sequence = sequence;
518  rename uspc_mainclass_id = mainclass_id;
519  *if sequence = 0;
520  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      515:9
NOTE: Invalid numeric data, patent_id='D905368' , at line 515 column 9.
patent_id=D905368 uspc_sequence=0 uspc_mainclass_id=D34
uspc_mainclass_title=MATERIAL OR ARTICLE HANDLING EQUIPMENT uspc_subclass_id=D34/12
uspc_subclass_title=HAND CART OR FRAME THEREFOR nr_pt=. _ERROR_=1 _N_=4
NOTE: Invalid numeric data, patent_id='D723635' , at line 515 column 9.
patent_id=D723635 uspc_sequence=0 uspc_mainclass_id=D21
uspc_mainclass_title=GAMES, TOYS, AND SPORTS GOODS uspc_subclass_id=D21/662
uspc_subclass_title=EXERCISE EQUIPMENT nr_pt=. _ERROR_=1 _N_=6
NOTE: Invalid numeric data, patent_id='D506726' , at line 515 column 9.
patent_id=D506726 uspc_sequence=0 uspc_mainclass_id=D13
uspc_mainclass_title=EQUIPMENT FOR PRODUCTION, DISTRIBUTION, OR TRANSFORMATION OF ENERGY
uspc_subclass_id=D13/110 uspc_subclass_title=Transformer, rectifier or casing therefor (3)
nr_pt=. _ERROR_=1 _N_=9
NOTE: Invalid numeric data, patent_id='D857218' , at line 515 column 9.
patent_id=D857218 uspc_sequence=0 uspc_mainclass_id=D24
uspc_mainclass_title=MEDICAL AND LABORATORY EQUIPMENT uspc_subclass_id=D24/206
uspc_subclass_title=Thermal nr_pt=. _ERROR_=1 _N_=19
NOTE: Invalid numeric data, patent_id='D555377' , at line 515 column 9.
patent_id=D555377 uspc_sequence=0 uspc_mainclass_id=D6 uspc_mainclass_title=FURNISHINGS
uspc_subclass_id=D6/366 uspc_subclass_title=  nr_pt=. _ERROR_=1 _N_=24
NOTE: Invalid numeric data, patent_id='D552350' , at line 515 column 9.
patent_id=D552350 uspc_sequence=0 uspc_mainclass_id=D3
uspc_mainclass_title=TRAVEL GOODS AND PERSONAL BELONGINGS uspc_subclass_id=D3/290
uspc_subclass_title=  nr_pt=. _ERROR_=1 _N_=28
NOTE: Invalid numeric data, patent_id='D799021' , at line 515 column 9.
patent_id=D799021 uspc_sequence=0 uspc_mainclass_id=D23
uspc_mainclass_title=ENVIRONMENTAL HEATING AND COOLING; FLUID HANDLING AND SANITARY EQUIPMENT
uspc_subclass_id=D23/379 uspc_subclass_title=With exposed blade nr_pt=. _ERROR_=1 _N_=55
NOTE: Invalid numeric data, patent_id='D569753' , at line 515 column 9.
patent_id=D569753 uspc_sequence=0 uspc_mainclass_id=D10
uspc_mainclass_title=MEASURING, TESTING, OR SIGNALLING INSTRUMENTS uspc_subclass_id=D10/104
uspc_subclass_title=  nr_pt=. _ERROR_=1 _N_=67
NOTE: Invalid numeric data, patent_id='D971409' , at line 515 column 9.
patent_id=D971409 uspc_sequence=0 uspc_mainclass_id=D24
uspc_mainclass_title=MEDICAL AND LABORATORY EQUIPMENT uspc_subclass_id=D24/152
uspc_subclass_title=Dental (33) nr_pt=. _ERROR_=1 _N_=72
NOTE: Invalid numeric data, patent_id='D713222' , at line 515 column 9.
patent_id=D713222 uspc_sequence=0 uspc_mainclass_id=D8
uspc_mainclass_title=TOOLS AND HARDWARE uspc_subclass_id=D8/1 uspc_subclass_title=  nr_pt=.
_ERROR_=1 _N_=74
NOTE: Invalid numeric data, patent_id='D747490' , at line 515 column 9.
patent_id=D747490 uspc_sequence=0 uspc_mainclass_id=D24
uspc_mainclass_title=MEDICAL AND LABORATORY EQUIPMENT uspc_subclass_id=D24/169
uspc_subclass_title=Hematological or intravenous treatment (41) nr_pt=. _ERROR_=1 _N_=80
NOTE: Invalid numeric data, patent_id='D597974' , at line 515 column 9.
patent_id=D597974 uspc_sequence=0 uspc_mainclass_id=D14
uspc_mainclass_title=RECORDING, COMMUNICATION, OR INFORMATION RETRIEVAL EQUIPMENT
uspc_subclass_id=D14/126 uspc_subclass_title=Receiver or monitor nr_pt=. _ERROR_=1 _N_=84
NOTE: Invalid numeric data, patent_id='D779952' , at line 515 column 9.
patent_id=D779952 uspc_sequence=0 uspc_mainclass_id=D9
uspc_mainclass_title=PACKAGES AND CONTAINERS FOR GOODS uspc_subclass_id=D9/560
uspc_subclass_title=  nr_pt=. _ERROR_=1 _N_=86
NOTE: Invalid numeric data, patent_id='D780318' , at line 515 column 9.
patent_id=D780318 uspc_sequence=0 uspc_mainclass_id=D24
uspc_mainclass_title=MEDICAL AND LABORATORY EQUIPMENT uspc_subclass_id=D24/192
uspc_subclass_title=Foot or ankle nr_pt=. _ERROR_=1 _N_=97
NOTE: Invalid numeric data, patent_id='D509471' , at line 515 column 9.
patent_id=D509471 uspc_sequence=0 uspc_mainclass_id=D12 uspc_mainclass_title=TRANSPORTATION
uspc_subclass_id=D12/414 uspc_subclass_title=Side rail or barrier type (27) nr_pt=. _ERROR_=1
_N_=100
NOTE: Invalid numeric data, patent_id='PP31143' , at line 515 column 9.
patent_id=PP31143 uspc_sequence=0 uspc_mainclass_id=PLT uspc_mainclass_title=PLANTS
uspc_subclass_id=PLT/472 uspc_subclass_title=Primula nr_pt=. _ERROR_=1 _N_=109
NOTE: Invalid numeric data, patent_id='D733429' , at line 515 column 9.
patent_id=D733429 uspc_sequence=0 uspc_mainclass_id=D3
uspc_mainclass_title=TRAVEL GOODS AND PERSONAL BELONGINGS uspc_subclass_id=D3/294
uspc_subclass_title=  nr_pt=. _ERROR_=1 _N_=110
NOTE: Invalid numeric data, patent_id='PP30373' , at line 515 column 9.
patent_id=PP30373 uspc_sequence=0 uspc_mainclass_id=PLT uspc_mainclass_title=PLANTS
uspc_subclass_id=PLT/373 uspc_subclass_title=HERBACEOUS ORNAMENTAL FOLIAGE PLANT nr_pt=.
_ERROR_=1 _N_=112
NOTE: Invalid numeric data, patent_id='D840706' , at line 515 column 9.
patent_id=D840706 uspc_sequence=0 uspc_mainclass_id=D6 uspc_mainclass_title=FURNISHINGS
uspc_subclass_id=D6/375 uspc_subclass_title=  nr_pt=. _ERROR_=1 _N_=116
NOTE: Invalid numeric data, patent_id='D901143' , at line 515 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=D901143 uspc_sequence=0 uspc_mainclass_id=D2
uspc_mainclass_title=APPAREL AND HABERDASHERY uspc_subclass_id=D2/947 uspc_subclass_title=
nr_pt=. _ERROR_=1 _N_=131
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1106327 at 515:19
NOTE: There were 20796039 observations read from the data set WORK.USPC.
NOTE: The data set WORK.USPC1 has 19689712 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           6.74 seconds
      cpu time            5.10 seconds


520!      *19689712;
521  proc sort data = uspc1; by patent_id sequence; run;

NOTE: There were 19689712 observations read from the data set WORK.USPC1.
NOTE: The data set WORK.USPC1 has 19689712 observations and 7 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           19.67 seconds
      cpu time            24.78 seconds


522  proc sql;
522!           *19689712;
523      create table uspc2 as select distinct
524      nr_pt, mainclass_id
525      from uspc1
526  ;
NOTE: Table WORK.USPC2 created, with 8356168 rows and 2 columns.

527      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           4.96 seconds
      cpu time            5.79 seconds


527!           *8356168;
528  proc sql;
528!           *2628164;
529      create table cinv_ext_pclass as select distinct
530      a.*, b.*
531      from cinv_ext_pat as a left join uspc2 as b
532      on a.nr_pt = b.nr_pt;
WARNING: Variable nr_pt already exists on file WORK.CINV_EXT_PCLASS.
NOTE: Table WORK.CINV_EXT_PCLASS created, with 3692692 rows and 7 columns.

533      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.93 seconds
      cpu time            3.81 seconds


533!           * 3692692;
534  PROC EXPORT DATA= cinv_ext_pclass
535              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
535! files\cinv_ext_pclass.dta"
536              DBMS=STATA REPLACE;
537      RUN;

NOTE: The export data set has 3692692 observations and 7 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\cinv_ext_pclass.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.50 seconds
      cpu time            0.48 seconds


538  ******measure originality;
539  **kpss;
540  data pat_kpss_clean;
541  set pat_kpss;
542  grantdate =Input(Put(issue_date, 8.), Yymmdd10.);
543  filedate = Input(Put(filing_date, 8.), Yymmdd10.);
544  format grantdate filedate date9.;
545  drop issue_date filing_date;
546  run;

NOTE: There were 3160453 observations read from the data set WORK.PAT_KPSS.
NOTE: The data set WORK.PAT_KPSS_CLEAN has 3160453 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.64 seconds
      cpu time            0.62 seconds


546!     * 3160453;
547  proc sql;
547!            * 133954965;
548      create table pat_bcite as select distinct
549      patent_id, citation_patent_id as citb_patent_id
550      from uspto_cite ;
NOTE: Table WORK.PAT_BCITE created, with 133709407 rows and 2 columns.

551      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           26.57 seconds
      cpu time            40.43 seconds


552  run; *  133709407;
553  data pat_bcite1;
554  set pat_bcite;
555  patent_num = patent_id +0;
556  if not missing(patent_num);
557  drop patent_id;
558  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      555:14
NOTE: Invalid numeric data, patent_id='D242583' , at line 555 column 14.
patent_id=D242583 citb_patent_id=3822488 patent_num=. _ERROR_=1 _N_=119162306
NOTE: Invalid numeric data, patent_id='D242583' , at line 555 column 14.
patent_id=D242583 citb_patent_id=D226884 patent_num=. _ERROR_=1 _N_=119162307
NOTE: Invalid numeric data, patent_id='D242583' , at line 555 column 14.
patent_id=D242583 citb_patent_id=D227519 patent_num=. _ERROR_=1 _N_=119162308
NOTE: Invalid numeric data, patent_id='D242583' , at line 555 column 14.
patent_id=D242583 citb_patent_id=D227821 patent_num=. _ERROR_=1 _N_=119162309
NOTE: Invalid numeric data, patent_id='D242583' , at line 555 column 14.
patent_id=D242583 citb_patent_id=D229251 patent_num=. _ERROR_=1 _N_=119162310
NOTE: Invalid numeric data, patent_id='D242583' , at line 555 column 14.
patent_id=D242583 citb_patent_id=D235700 patent_num=. _ERROR_=1 _N_=119162311
NOTE: Invalid numeric data, patent_id='D242584' , at line 555 column 14.
patent_id=D242584 citb_patent_id=3843991 patent_num=. _ERROR_=1 _N_=119162312
NOTE: Invalid numeric data, patent_id='D242584' , at line 555 column 14.
patent_id=D242584 citb_patent_id=D227718 patent_num=. _ERROR_=1 _N_=119162313
NOTE: Invalid numeric data, patent_id='D242584' , at line 555 column 14.
patent_id=D242584 citb_patent_id=D236666 patent_num=. _ERROR_=1 _N_=119162314
NOTE: Invalid numeric data, patent_id='D242585' , at line 555 column 14.
patent_id=D242585 citb_patent_id=3447181 patent_num=. _ERROR_=1 _N_=119162315
NOTE: Invalid numeric data, patent_id='D242585' , at line 555 column 14.
patent_id=D242585 citb_patent_id=D211315 patent_num=. _ERROR_=1 _N_=119162316
NOTE: Invalid numeric data, patent_id='D242585' , at line 555 column 14.
patent_id=D242585 citb_patent_id=D211851 patent_num=. _ERROR_=1 _N_=119162317
NOTE: Invalid numeric data, patent_id='D242585' , at line 555 column 14.
patent_id=D242585 citb_patent_id=D236564 patent_num=. _ERROR_=1 _N_=119162318
NOTE: Invalid numeric data, patent_id='D242586' , at line 555 column 14.
patent_id=D242586 citb_patent_id=3843991 patent_num=. _ERROR_=1 _N_=119162319
NOTE: Invalid numeric data, patent_id='D242586' , at line 555 column 14.
patent_id=D242586 citb_patent_id=D211315 patent_num=. _ERROR_=1 _N_=119162320
NOTE: Invalid numeric data, patent_id='D242586' , at line 555 column 14.
patent_id=D242586 citb_patent_id=D227718 patent_num=. _ERROR_=1 _N_=119162321
NOTE: Invalid numeric data, patent_id='D242586' , at line 555 column 14.
patent_id=D242586 citb_patent_id=D236564 patent_num=. _ERROR_=1 _N_=119162322
NOTE: Invalid numeric data, patent_id='D242586' , at line 555 column 14.
patent_id=D242586 citb_patent_id=D236666 patent_num=. _ERROR_=1 _N_=119162323
NOTE: Invalid numeric data, patent_id='D242587' , at line 555 column 14.
patent_id=D242587 citb_patent_id=D168443 patent_num=. _ERROR_=1 _N_=119162324
NOTE: Invalid numeric data, patent_id='D242587' , at line 555 column 14.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=D242587 citb_patent_id=D226647 patent_num=. _ERROR_=1 _N_=119162325
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      14547102 at 555:24
NOTE: There were 133709407 observations read from the data set WORK.PAT_BCITE.
NOTE: The data set WORK.PAT_BCITE1 has 119162305 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           7.19 seconds
      cpu time            7.07 seconds


558!      *119162305;
559  proc sql;
559!            *3160453;
560      create table pat_kpss_bcite as select distinct
561      a.*, b.*
562      from pat_kpss_clean as a left join pat_bcite1 as b
563      on a.patent_num = b.patent_num;
WARNING: Variable patent_num already exists on file WORK.PAT_KPSS_BCITE.
NOTE: Table WORK.PAT_KPSS_BCITE created, with 43436389 rows and 8 columns.

564      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           37.78 seconds
      cpu time            1:05.40


565  run; *43436389;
566  data pat_kpss_bcite1;
567  set pat_kpss_bcite;
568  citb_patent_num = citb_patent_id +0;
569  if not missing(citb_patent_num);
570  drop citb_patent_id date_filing_citb;
571  rename patent_num = nr_pt;
572  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      568:19
WARNING: The variable date_filing_citb in the DROP, KEEP, or RENAME list has never been
         referenced.
NOTE: Invalid numeric data, citb_patent_id='R23091' , at line 568 column 19.
patent_num=3930377 permno=20124 xi_nominal=5.423360144 xi_real=9.0948445026 cites=5
grantdate=06JAN1976 filedate=17SEP1973 citb_patent_id=R23091 citb_patent_num=. _ERROR_=1
_N_=616166
NOTE: Invalid numeric data, citb_patent_id='R19070' , at line 568 column 19.
patent_num=3930729 permno=12490 xi_nominal=16.605303843 xi_real=27.846695104 cites=6
grantdate=06JAN1976 filedate=29JUN1973 citb_patent_id=R19070 citb_patent_num=. _ERROR_=1
_N_=616731
NOTE: Invalid numeric data, citb_patent_id='R25056' , at line 568 column 19.
patent_num=3930927 permno=22592 xi_nominal=8.2018912822 xi_real=13.754374384 cites=6
grantdate=06JAN1976 filedate=20MAY1974 citb_patent_id=R25056 citb_patent_num=. _ERROR_=1
_N_=617200
NOTE: Invalid numeric data, citb_patent_id='R28010' , at line 568 column 19.
patent_num=3930927 permno=22592 xi_nominal=8.2018912822 xi_real=13.754374384 cites=6
grantdate=06JAN1976 filedate=20MAY1974 citb_patent_id=R28010 citb_patent_num=. _ERROR_=1
_N_=617201
NOTE: Invalid numeric data, citb_patent_id='R27279' , at line 568 column 19.
patent_num=3931073 permno=11754 xi_nominal=15.500979391 xi_real=25.994769562 cites=6
grantdate=06JAN1976 filedate=22JUL1974 citb_patent_id=R27279 citb_patent_num=. _ERROR_=1
_N_=617544
NOTE: Invalid numeric data, citb_patent_id='R27682' , at line 568 column 19.
patent_num=3931108 permno=17209 xi_nominal=0.5059299059 xi_real=0.8484322821 cites=10
grantdate=06JAN1976 filedate=24OCT1973 citb_patent_id=R27682 citb_patent_num=. _ERROR_=1
_N_=617653
NOTE: Invalid numeric data, citb_patent_id='R26791' , at line 568 column 19.
patent_num=3931839 permno=10890 xi_nominal=20.606955396 xi_real=34.5573685 cites=1
grantdate=13JAN1976 filedate=04MAR1975 citb_patent_id=R26791 citb_patent_num=. _ERROR_=1
_N_=619031
NOTE: Invalid numeric data, citb_patent_id='R27926' , at line 568 column 19.
patent_num=3932310 permno=25005 xi_nominal=0.7540792762 xi_real=1.2645728067 cites=7
grantdate=13JAN1976 filedate=07MAR1974 citb_patent_id=R27926 citb_patent_num=. _ERROR_=1
_N_=619939
NOTE: Invalid numeric data, citb_patent_id='R25763' , at line 568 column 19.
patent_num=3932372 permno=38375 xi_nominal=1.116405508 xi_real=1.8721851818 cites=10
grantdate=13JAN1976 filedate=15NOV1973 citb_patent_id=R25763 citb_patent_num=. _ERROR_=1
_N_=620154
NOTE: Invalid numeric data, citb_patent_id='R26497' , at line 568 column 19.
patent_num=3932756 permno=17822 xi_nominal=1.3582504351 xi_real=2.277753307 cites=21
grantdate=13JAN1976 filedate=24JUN1974 citb_patent_id=R26497 citb_patent_num=. _ERROR_=1
_N_=620791
NOTE: Invalid numeric data, citb_patent_id='R25405' , at line 568 column 19.
patent_num=3932888 permno=11754 xi_nominal=10.427919105 xi_real=17.487369496 cites=6
grantdate=13JAN1976 filedate=10JUN1974 citb_patent_id=R25405 citb_patent_num=. _ERROR_=1
_N_=621002
NOTE: Invalid numeric data, citb_patent_id='R21942' , at line 568 column 19.
patent_num=3933384 permno=14066 xi_nominal=2.4220466618 xi_real=4.0617139895 cites=5
grantdate=20JAN1976 filedate=07OCT1974 citb_patent_id=R21942 citb_patent_num=. _ERROR_=1
_N_=621753
NOTE: Invalid numeric data, citb_patent_id='R15120' , at line 568 column 19.
patent_num=3933551 permno=55781 xi_nominal=3.2572648067 xi_real=5.4623547274 cites=7
grantdate=20JAN1976 filedate=30NOV1973 citb_patent_id=R15120 citb_patent_num=. _ERROR_=1
_N_=622125
NOTE: Invalid numeric data, citb_patent_id='R18967' , at line 568 column 19.
patent_num=3933643 permno=25064 xi_nominal=1.1350212766 xi_real=1.9034033779 cites=46
grantdate=20JAN1976 filedate=10SEP1971 citb_patent_id=R18967 citb_patent_num=. _ERROR_=1
_N_=622313
NOTE: Invalid numeric data, citb_patent_id='R27772' , at line 568 column 19.
patent_num=3934109 permno=12431 xi_nominal=5.8101869059 xi_real=9.7435436772 cites=7
grantdate=20JAN1976 filedate=07FEB1974 citb_patent_id=R27772 citb_patent_num=. _ERROR_=1
_N_=623287
NOTE: Invalid numeric data, citb_patent_id='R25576' , at line 568 column 19.
patent_num=3934412 permno=57681 xi_nominal=3.2753411075 xi_real=5.492668249 cites=6
grantdate=27JAN1976 filedate=08AUG1974 citb_patent_id=R25576 citb_patent_num=. _ERROR_=1
_N_=623848
NOTE: Invalid numeric data, citb_patent_id='R15120' , at line 568 column 19.
patent_num=3935045 permno=16432 xi_nominal=0.9149541366 xi_real=1.5343560779 cites=15
grantdate=27JAN1976 filedate=26OCT1973 citb_patent_id=R15120 citb_patent_num=. _ERROR_=1
_N_=624918
NOTE: Invalid numeric data, citb_patent_id='T908010' , at line 568 column 19.
patent_num=3935339 permno=11850 xi_nominal=34.342893942 xi_real=57.592207024 cites=42
grantdate=27JAN1976 filedate=16JUL1973 citb_patent_id=T908010 citb_patent_num=. _ERROR_=1
_N_=625483
NOTE: Invalid numeric data, citb_patent_id='R25725' , at line 568 column 19.
patent_num=3935555 permno=53727 xi_nominal=0.0529662427 xi_real=0.088823115 cites=1
grantdate=27JAN1976 filedate=10OCT1974 citb_patent_id=R25725 citb_patent_num=. _ERROR_=1
_N_=626019
NOTE: Invalid numeric data, citb_patent_id='D120125' , at line 568 column 19.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_num=3935944 permno=27887 xi_nominal=8.9354596308 xi_real=14.984550858 cites=26
grantdate=03FEB1976 filedate=10JUN1974 citb_patent_id=D120125 citb_patent_num=. _ERROR_=1
_N_=626656
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1175523 at 568:34
NOTE: There were 43436389 observations read from the data set WORK.PAT_KPSS_BCITE.
NOTE: The data set WORK.PAT_KPSS_BCITE1 has 42260866 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           4.37 seconds
      cpu time            3.75 seconds


572!      *42260866;
573  proc sql;
573!           *42260866;
574      create table cpciteb_class as select distinct
575      a.*, b.mainclass_id
576      from pat_kpss_bcite1 as a left join uspc2 as b
577      on a.citb_patent_num = b.nr_pt;
NOTE: Table WORK.CPCITEB_CLASS created, with 68289253 rows and 9 columns.

578      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:08.75
      cpu time            1:32.07


578!           *68289253;
579  proc sql;
579!           *68289253;
580      create table cpcitebpc as select distinct
581      *, count(mainclass_id) as nclass
582      from cpciteb_class
583  group by nr_pt, mainclass_id;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CPCITEBPC created, with 68289253 rows and 10 columns.

584      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:15.13
      cpu time            1:31.21


584!           *68289253;
585  proc sql;
585!           *68289253;
586      create table cpcitebpc1 as select distinct
587      *, count(mainclass_id) as tclass
588      from cpcitebpc
589  group by nr_pt;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CPCITEBPC1 created, with 68289253 rows and 11 columns.

590      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           49.15 seconds
      cpu time            48.15 seconds


590!           *68289253;
591  proc sql;
591!           *68289253;
592      create table cpcitebpc2 as select distinct
593      nr_pt, mainclass_id, nclass, tclass
594      from cpcitebpc1
595  ;
NOTE: Table WORK.CPCITEBPC2 created, with 16195347 rows and 4 columns.

596      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           11.93 seconds
      cpu time            19.89 seconds


596!           *5292458;
597  data cpcitebpc3;
598  set cpcitebpc2;
599  per_class = nclass/tclass;
600  pclass2 = per_class*per_class;
601  run;

NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930273 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=1
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930295 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=2
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930296 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=3
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930299 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=4
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930300 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=5
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930306 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=6
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930307 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=7
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930308 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=8
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930323 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=9
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930325 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=10
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930342 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=11
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930348 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=12
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930350 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=13
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930351 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=14
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930352 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=15
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930358 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=16
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930359 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=17
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930360 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=18
NOTE: Division by zero detected at line 599 column 19.
nr_pt=3930366 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=19
NOTE: Division by zero detected at line 599 column 19.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
nr_pt=3930367 mainclass_id=  nclass=0 tclass=0 per_class=. pclass2=. _ERROR_=1 _N_=20
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      144320 at 600:20
NOTE: Mathematical operations could not be performed at the following places. The results of
      the operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      144320 at 599:19
NOTE: There were 16195347 observations read from the data set WORK.CPCITEBPC2.
NOTE: The data set WORK.CPCITEBPC3 has 16195347 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           1.14 seconds
      cpu time            1.15 seconds


602  proc sql;
602!           *5292458;
603      create table cpcitebpc4 as select distinct
604      nr_pt, sum(pclass2) as hhi_pclass
605      from cpcitebpc3
606      group by nr_pt;
NOTE: Table WORK.CPCITEBPC4 created, with 2388146 rows and 2 columns.

607  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.23 seconds
      cpu time            3.18 seconds


607!       * 3130391;
608  data cpcitebpc5;
609  set cpcitebpc4;
610  if missing(hhi_pclass) then hhi_pclass = 0;
611  orig = 1- hhi_pclass;
612  if not missing(nr_pt);
613  run;

NOTE: There were 2388146 observations read from the data set WORK.CPCITEBPC4.
NOTE: The data set WORK.CPCITEBPC5 has 2388146 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.09 seconds
      cpu time            0.07 seconds


614  **merge with cinv_ext;
615  proc sql;
615!           *42260866;
616      create table cinv_ext_orig as select distinct
617      a.*, b.orig
618      from cinv_ext as a left join cpcitebpc5 as b
619      on a.nr_pt = b.nr_pt;
NOTE: Table WORK.CINV_EXT_ORIG created, with 2628164 rows and 18 columns.

620      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           2.55 seconds
      cpu time            4.96 seconds


620!           *2628164;* 3130391;
621  data cinv_ext_origa;
622  set  cinv_ext_orig;
623  if missing(orig) and not missing(nr_pt) then orig =1;
624  run;

NOTE: There were 2628164 observations read from the data set WORK.CINV_EXT_ORIG.
NOTE: The data set WORK.CINV_EXT_ORIGA has 2628164 observations and 18 variables.
NOTE: DATA statement used (Total process time):
      real time           0.30 seconds
      cpu time            0.31 seconds


625  proc sql;
625!           *2628164;
626      create table cinv_ext_val as select distinct
627      gvkey, fyear, datadate, cfips, sum(cites) as tcites, mean(cites) as mcites,
627! sum(ncite_ns3) as tncite_ns3, mean(ncite_ns3) as mncite_ns3, sum(ncite_ns3tr) as
627! tncite_ns3tr, mean(ncite_ns3tr) as mncite_ns3tr, sum(ncitetr) as tncitetr, mean(ncitetr)
627!  as mncitetr, sum(orig) as torig,
628      mean(orig) as morig, sum(xi_real) as txir, mean(xi_real) as mxir, sum(xi_nominal) as
628!  txin, mean(xi_nominal) as mxin
629  from cinv_ext_origa
630  group by gvkey, fyear, cfips;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CINV_EXT_VAL created, with 578470 rows and 18 columns.

631      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.88 seconds
      cpu time            3.65 seconds


632  run; *578470;
633
634  data sas.pat_val_kpss;
635  set cinv_ext_val;
636  run;

NOTE: There were 578470 observations read from the data set WORK.CINV_EXT_VAL.
NOTE: The data set SAS.PAT_VAL_KPSS has 578470 observations and 18 variables.
NOTE: DATA statement used (Total process time):
      real time           0.11 seconds
      cpu time            0.11 seconds


637  PROC EXPORT DATA= sas.pat_val_kpss
638              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
638! files\pat_val_kpss.dta"
639              DBMS=STATA REPLACE;
640      RUN;

NOTE: The export data set has 578470 observations and 18 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\pat_val_kpss.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.22 seconds
      cpu time            0.15 seconds


