870  **patents of subsidy firms with no gvkey;
871  proc import out=sfirms_nogvkey
871! datafile="C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
871! files\subfirms_nogvkey_newmatch2.dta" dbms=dta replace; run; *  1221;

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 1221 observations and 6 variables.
NOTE: WORK.SFIRMS_NOGVKEY data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.07 seconds
      cpu time            0.04 seconds


872  proc sql;
872!            *6738255;
873      create table casg_1firmpat as select distinct
874      a.*, b.filing_date
875      from casg_1firm2 as a left join uspto_pat as b
876      on a.patent_id = b.patent_id;
NOTE: Table WORK.CASG_1FIRMPAT created, with 6738255 rows and 5 columns.

877      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           8.92 seconds
      cpu time            14.31 seconds


877!            *6738255;
878  data casg_1firmpat1;
879  set casg_1firmpat;
880  year = substr(filing_date,1,4)+0;
881  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      880:8
NOTE: There were 6738255 observations read from the data set WORK.CASG_1FIRMPAT.
NOTE: The data set WORK.CASG_1FIRMPAT1 has 6738255 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           1.26 seconds
      cpu time            1.25 seconds


882  proc sql;
882!           *1221;
883      create table sfirms_pat as select distinct
884      a.*, b.nr_pt, b.year as filing_year
885      from sfirms_nogvkey as a left join casg_1firmpat1 as b
886      on a.assignee_id = b.assignee_id;
NOTE: Table WORK.SFIRMS_PAT created, with 358587 rows and 8 columns.

887      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           4.05 seconds
      cpu time            8.56 seconds


887!           * 358587;
888  proc sql;
888!            *21197038;
889      create table patinvloc as select distinct
890      a.*, b.*
891      from uspto_patinv1 as a left join uspto_loc1 as b
892      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.

893      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1:22.05
      cpu time            1:44.34


894  run; * 21197038;
895  data patinvloc1;
896  set patinvloc;
897  nr_pt = patent_id + 0;
898  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      897:9
NOTE: Invalid numeric data, patent_id='D242583' , at line 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897 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 897: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           9.11 seconds
      cpu time            7.40 seconds


898!      * 21197038;
899  proc sql;
899!           * 358587;
900      create table sfirms_patloc as select distinct
901      a.*, b.state_fips, b.county_fips
902      from sfirms_pat as a left join patinvloc1 as b
903      on a.nr_pt = b.nr_pt;
NOTE: Table WORK.SFIRMS_PATLOC created, with 1003278 rows and 10 columns.

904      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           10:53.46
      cpu time            11:03.36


904!           * 1003278;
905  data sfirms_patloc1;
906  set sfirms_patloc;
907  rename cfips = foc_cfips;
908  cfips1 = state_fips*1000+county_fips;
909  drop state_fips county_fips;
910  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      908:10   908:26
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).
      280892 at 908:20
NOTE: There were 1003278 observations read from the data set WORK.SFIRMS_PATLOC.
NOTE: The data set WORK.SFIRMS_PATLOC1 has 1003278 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.53 seconds
      cpu time            0.45 seconds


911  proc sql;
911!           * 358587;
912      create table sfirms_pclass as select distinct
913      a.company, a.cfips, a.nr_pt, a.filing_year, b.*
914      from sfirms_pat as a left join uspc2 as b
915      on a.nr_pt = b.nr_pt;
WARNING: Variable nr_pt already exists on file WORK.SFIRMS_PCLASS.
NOTE: Table WORK.SFIRMS_PCLASS created, with 497091 rows and 5 columns.

916      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.77 seconds
      cpu time            1.65 seconds


916!           * 497091;
917  PROC EXPORT DATA= sfirms_pat
918              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
918! files\sfirms_pat.dta"
919              DBMS=STATA REPLACE;
920      RUN;

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


921  PROC EXPORT DATA= sfirms_patloc1
922              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
922! files\sfirms_patloc.dta"
923              DBMS=STATA REPLACE;
924      RUN;

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


925  PROC EXPORT DATA= sfirms_pclass
926              OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
926! files\sfirms_pclass.dta"
927              DBMS=STATA REPLACE;
928      RUN;

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