NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)
      Licensed to CITY UNIVERSITY OF NEW YORK, Site 70080308.
NOTE: This session is executing on the X64_10PRO  platform.



NOTE: Updated analytical products:

      SAS/STAT 14.3
      SAS/ETS 14.3
      SAS/OR 14.3
      SAS/IML 14.3
      SAS/QC 14.3

NOTE: Additional host information:

 X64_10PRO WIN 10.0.22621  Workstation

NOTE: SAS initialization used:
      real time           1.93 seconds
      cpu time            0.62 seconds

1    libname dist 'C:\Users\yjia\Dropbox\dist';
NOTE: Libref DIST was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\yjia\Dropbox\dist
2
3    /**import raw data***/
4    PROC IMPORT OUT= work.eff DATAFILE= "C:\Users\yjia\Dropbox\dist\court_eff_0320_final.xlsx"
5                DBMS=xlsx REPLACE;
6         SHEET="Sheet1";
7         GETNAMES=YES;
8    RUN;

NOTE:    Variable Name Change.  Weighted Filing -> Weighted_Filing
NOTE:    Variable Name Change.  Number of vacant judge -> Number_of_vacant_judge
NOTE:    Variable Name Change.  From filing to disposition -> From_filing_to_disposition
NOTE:    Variable Name Change.  Number of Judge -> Number_of_Judge
NOTE:    Variable Name Change.  from filing to trial -> from_filing_to_trial
NOTE:    Variable Name Change.  number of case over 3 year old -> number_of_case_over_3_year_old
NOTE:    Variable Name Change.  Number of Civl filings -> Number_of_Civl_filings
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 2538 observations and 16 variables.
NOTE: WORK.EFF data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.35 seconds
      cpu time            0.31 seconds


9
10   /**create lag***/
11    proc sql;
12   create table eff1 as
13   select a.*,b.pending as lag_pending,b.Number_of_Judge as lag_Number_of_Judge,
13 ! b.number_of_vacant_judge as lag_number_of_vacant_judge
14   from eff a left join eff b
15   on a.court= b.court and a.year= b.year+1;
NOTE: Table WORK.EFF1 created, with 2538 rows and 19 columns.

16   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.03 seconds


17
18   data eff2;
19   set eff1;
20   to = Terminations/((pending + lag_pending)/2);
21   pending_j = pending/((Number_of_Judge*12-number_of_vacant_judge)/12);
22   avg_judgeship = (((Number_of_Judge*12-number_of_vacant_judge)/12) +
22 ! ((lag_Number_of_Judge*12-lag_number_of_vacant_judge)/12))/2;
23   wfiling_j = (Weighted_Filing* Number_of_Judge)
23 ! /((Number_of_Judge*12-number_of_vacant_judge)/12);
24   to_time = 12/to;
25   run;

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).
      94 at 20:29   94 at 22:90   94 at 24:13
NOTE: There were 2538 observations read from the data set WORK.EFF1.
NOTE: The data set WORK.EFF2 has 2538 observations and 24 variables.
NOTE: DATA statement used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds


26
27   /**export to compute pca**/
28   PROC exPORT DATA=eff2
29               FILE='C:\Users\yjia\Dropbox\dist\eff_measure_A.dta'
30               DBMS=stata REPLACE;
31   quit;

NOTE: The export data set has 2538 observations and 24 variables.
NOTE: "C:\Users\yjia\Dropbox\dist\eff_measure_A.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


32
33   /**import vacancies data***/
34   PROC IMPORT OUT= work.vacant DATAFILE=
34 ! "C:\Users\yjia\Dropbox\dist\20200616_judge_retire.xlsx"
35               DBMS=xlsx REPLACE;
36        SHEET="Sheet1";
37        GETNAMES=YES;
38   RUN;

NOTE:    Variable Name Change.  Nomination Date -> Nomination_Date
NOTE:    Variable Name Change.  Commission Date -> Commission_Date
NOTE:    Variable Name Change.  Judge Doc -> Judge_Doc
NOTE:    Variable Name Change.  total Doc -> total_Doc
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 171 observations and 10 variables.
NOTE: WORK.VACANT data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds


39   data vacant1;
40   set vacant;
41   duration = Commission_Date - date;
42   if note ='Disability'  or note = 'Deceased';
43   if Judge_Doc ~=.;
44   if total_doc ~=.;
45   run;

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).
      24 at 41:28
NOTE: There were 171 observations read from the data set WORK.VACANT.
NOTE: The data set WORK.VACANT1 has 22 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
      cpu time            0.01 seconds


46
47
48   proc sort data = vacant1;
49   by date;
50   quit;

NOTE: There were 22 observations read from the data set WORK.VACANT1.
NOTE: The data set WORK.VACANT1 has 22 observations and 11 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


51
52
53   data list2;
54   set eff2;
55   keep year court state district Number_of_Judge Filings ;
56   run;

NOTE: There were 2538 observations read from the data set WORK.EFF2.
NOTE: The data set WORK.LIST2 has 2538 observations and 6 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


57
58   data vacant_all;
59   set  vacant;
60   if Judge_Doc ~=.;
61   if total_doc ~=.;
62   run;

NOTE: There were 171 observations read from the data set WORK.VACANT.
NOTE: The data set WORK.VACANT_ALL has 84 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


63
64   proc sort data = vacant_all;
65   by date;
66   quit;

NOTE: There were 84 observations read from the data set WORK.VACANT_ALL.
NOTE: The data set WORK.VACANT_ALL has 84 observations and 10 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


67   proc sql;
68   create table vacant2 as
69   select a.*,b.judge, b.date, b.nomination_date,b.Commission_Date
70   from list2 a left join vacant1 b
71   on a.state= b.district and a.district = b.court and year(b.date)<= a.year <=
71 ! year(b.Commission_Date)+1;
NOTE: Invalid (or missing) arguments to the YEAR function have caused the function to return a
      missing value.
NOTE: Table WORK.VACANT2 created, with 2538 rows and 10 columns.

72   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


73
74   proc sql;
75   create table vacant_all2 as
76   select a.*,b.judge, b.date, b.nomination_date,b.Commission_Date,b.Judge_Doc
77   from list2 a left join vacant_all b
78   on a.state= b.district and a.district = b.court and year(b.date)<= a.year <=
78 ! year(b.Commission_Date)+1;
NOTE: Invalid (or missing) arguments to the YEAR function have caused the function to return a
      missing value.
NOTE: Table WORK.VACANT_ALL2 created, with 2580 rows and 11 columns.

79   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds


80
81   data vacant2a;
82   set vacant2;
83   if judge = '' then count=0;
84   if judge ~='' then count=1;
85   run;

NOTE: There were 2538 observations read from the data set WORK.VACANT2.
NOTE: The data set WORK.VACANT2A has 2538 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


86   data vacant_all2a;
87   set vacant_all2;
88   doc_prop  = Judge_Doc/filings;
89   run;

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).
      2312 at 88:22
NOTE: There were 2580 observations read from the data set WORK.VACANT_ALL2.
NOTE: The data set WORK.VACANT_ALL2A has 2580 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


90
91   proc sql;
92   create table vacant3 as
93   select *,sum(count) as vacant_judge
94   from vacant2a
95   group by state,district,year;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.VACANT3 created, with 2538 rows and 12 columns.

96   quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds


97   proc sort data = vacant3 out=vacant4 nodupkey;
98   by year court state district;
99   quit;

NOTE: There were 2538 observations read from the data set WORK.VACANT3.
NOTE: 0 observations with duplicate key values were deleted.
NOTE: The data set WORK.VACANT4 has 2538 observations and 12 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


100  proc sql;
101  create table vacant_all3 as
102  select *,mean(doc_prop) as mean_prop
103  from vacant_all2a
104  group by state,district,year;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.VACANT_ALL3 created, with 2580 rows and 13 columns.

105  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds


106
107  proc sort data = vacant_all3 out=vacant_all4 nodupkey;
108  by year court state district;
109  quit;

NOTE: There were 2580 observations read from the data set WORK.VACANT_ALL3.
NOTE: 42 observations with duplicate key values were deleted.
NOTE: The data set WORK.VACANT_ALL4 has 2538 observations and 13 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


110
111  proc sql;
112  create table vacant_all5 as
113  select a.*,b.mean_prop as mean_prop_all2
114  from vacant4 a left join vacant_all4 b
115  on a.state= b.state and a.district = b.district and a.year=b.year;
NOTE: Table WORK.VACANT_ALL5 created, with 2538 rows and 13 columns.

116  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.02 seconds
      cpu time            0.00 seconds


117  data dist.C_judge_vacant;
118  set vacant_all5;
119  run;

NOTE: There were 2538 observations read from the data set WORK.VACANT_ALL5.
NOTE: The data set DIST.C_JUDGE_VACANT has 2538 observations and 13 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


