Appendix 2: Sample Stata Program
*** APP20.sas ***;
OPTIONS LS=132 PS=79;
libname jobs18 "c:\mydata\jobs18";
libname jobs19 "c:\mydata\jobs19";
libname jobs20 "c:\mydata\jobs20";
*** a. ***
*** Select continuing Panel 23 Round 5 or Panel 24 Round 3 ***
*** Current Main JOBS (SUBTYPE=1, STILLAT=1) from the FY 2020 JOBS file ***
*** and print selected variables from the first 20 observations ***;
data j20r53;
set jobs20.jobs20;
if ((panel=23 and rn=5 and origrnd<5)
or (panel=24 and rn=3 and origrnd<3))
and subtype=1
and stillat=1
and sickpay=-1
;
run;
proc print data=j20r53 (obs=20);
title1 'Print Sample of Continuation Current Main JOBS';
title2 'Panel 23 Round 5 or Panel 24 Round 3 Records';
var jobidx panel rn origrnd subtype stillat sickpay;
run;
*** b. ***
*** Select newly reported Panel 23 or Panel 24 Current Main JOBS ***
*** records from the FY 2019 JOBS file and print selected variables ***
*** from the first 20 observations. ***;
data j19;
set jobs19.jobs19;
if ((panel=23 and rn in (3,4))
or (panel=24 and rn in (1,2)))
and subtype=1
and stillat=-1
;
run;
proc print data= j19 (obs=20);
title1 'Print Sample of Newly Reported Current Main JOBS';
title2 'Panel 23 Round 3 or 4 or Panel 24 Round 1 or 2 Records';
var jobidx panel rn origrnd subtype stillat sickpay;
run;
proc freq data= j19 ;
tables sickpay/list missing;
title1 'Sickpay Value of FY2019 Newly Reported Current Main JOBS';
title2 'Panel 23 Round 3 or 4 or Panel 24 Round 1 or 2 Records';
run;
title2;
*** c. ***
*** Select newly reported Panel 23 Current Main JOBS records from ***
*** the FY 2018 JOBS file and print selected variables from the ***
*** first 20 observations. ***;
data j18;
set jobs18.jobs18;
if subtype=1
and stillat=-1
and panel=23
and rn in (1,2);
run;
proc print data=j18 (obs=20);
title1 'Print Sample of Newly Reported Current Main JOBS';
title2 'Panel 23 Round 1 or 2 Records';
var jobidx panel rn subtype stillat sickpay;
run;
proc freq data=j18;
tables sickpay/list missing;
title1 'Sickpay Value of FY2018 Newly Reported Current Main JOBS';
title2 'Panel 23 Round 1 or 2 Records';
run;
*** d. ***
*** Sort and merge datasets into J20R53F ***
*** Prepare FY2018, FY2019 and FY2020 data for merge ***;
proc sort data=j20r53;
by jobidx;
run;
proc sort data=j19;
by jobidx;
run;
proc sort data=j18;
by jobidx;
run;
*** e. ***
*** Create a dataset (J20R53F) that includes all variables ***
*** for the continuation Panel 23 Round 5 or Panel 24 Round 3 ***
*** Current Main JOBS and create the new variable SICKPAYX by ***
*** copying SICKPAY from the corresponding Round 1, Round 2, Round 3 ***
*** or Round 4 newly reported job record. Users may prefer to drop ***
*** "yy" variables at this point ***;
data j20r53f;
merge j20r53 (in=a)
j19 (in=b keep = jobidx sickpay rename=(sickpay=SICKPAY19))
j18 (in=c keep = jobidx sickpay rename=(sickpay=SICKPAY18));
by jobidx;
if a and b and SICKPAY19 ^= .
then SICKPAYX = SICKPAY19;
else if a and c and SICKPAY18 ^= .
then SICKPAYX = SICKPAY18;
if a and (b or c);
run;
proc freq data=j20r53f;
tables panel*rn*sickpay*sickpayx/list missing;
title1 'Diagnostic Post-Merge - Sickpay * Sickpayx';
title2 'Panel 23 Round 5 or Panel 24 Round 3 Continuation Current Main JOBS';
run;
Sample SAS Program Log
6 *** APP20.sas ***;
7
8 OPTIONS LS=132 PS=79;
9
10 ***
11 *** Program Name: SAMPLE.SAS ***
12 *** ***
13 *** Description: This job provides an example of how to get job info ***
14 *** from Round 1 or Round 2 in the FY2018 JOBS file ***
15 *** or Round 3 or Round 4 in the FY2019 when a continuation ***
16 *** current main job in the FY2020 JOBS file is ***
17 *** first reported in either FY2018 or FY2019 JOBS File. ***
18 *** ***
19 *** This example creates a dataset of continuation JOBS ***
20 *** records with a SICKPAYX variable copied from the ***
21 *** Round 1, 2, 3, or 4 newly reported job. ***
22 *** ***
23 ;
24
25 libname jobs18 "c:\mydata\jobs18";
26 libname jobs19 "c:\mydata\jobs19";
27 libname jobs20 "c:\mydata\jobs20";
28
29 *** a. ***
30 *** Select continuing Panel 23 Round 5 or Panel 24 Round 3 ***
31 *** Current Main JOBS (SUBTYPE=1, STILLAT=1) from the FY 2020 JOBS file ***
32 *** and print selected variables from the first 20 observations ***;
33
34 data j20r53;
35 set jobs20.jobs20;
36 if ((panel=23 and rn=5 and origrnd<5)
37 or (panel=24 and rn=3 and origrnd<3))
38 and subtype=1
39 and stillat=1
40 and sickpay=-1
41 ;
42 run;
NOTE: There were 47776 observations read from the data set JOBS20.JOBS20.
NOTE: The data set WORK.J20R53 has 7379 observations and 84 variables.
NOTE: Compressing data set WORK.J20R53 decreased size by 5.13 percent.
Compressed is 37 pages; un-compressed would require 39 pages.
NOTE: DATA statement used (Total process time):
real time 1.08 seconds
cpu time 0.04 seconds
43
44 proc print data=j20r53 (obs=20);
45 title1 'Print Sample of Continuation Current Main JOBS';
46 title2 'Panel 23 Round 5 or Panel 24 Round 3 Records';
47 var jobidx panel rn origrnd subtype stillat sickpay;
48 run;
NOTE: There were 20 observations read from the data set WORK.J20R53.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.10 seconds
cpu time 0.01 seconds
49
50
51 *** b. ***
52 *** Select newly reported Panel 23 or Panel 24 Current Main JOBS ***
53 *** records from the FY 2019 JOBS file and print selected variables ***
54 *** from the first 20 observations. ***;
55
56 data j19;
57 set jobs19.jobs19;
58 if ((panel=23 and rn in (3,4))
59 or (panel=24 and rn in (1,2)))
60 and subtype=1
61 and stillat=-1
62 ;
63 run;
NOTE: There were 50334 observations read from the data set JOBS19.JOBS19.
NOTE: The data set WORK.J19 has 8924 observations and 84 variables.
NOTE: Compressing data set WORK.J19 decreased size by 6.38 percent.
Compressed is 44 pages; un-compressed would require 47 pages.
NOTE: DATA statement used (Total process time):
real time 1.06 seconds
cpu time 0.07 seconds
64
65 proc print data= j19 (obs=20);
66 title1 'Print Sample of Newly Reported Current Main JOBS';
67 title2 'Panel 23 Round 3 or 4 or Panel 24 Round 1 or 2 Records';
68 var jobidx panel rn origrnd subtype stillat sickpay;
69 run;
NOTE: There were 20 observations read from the data set WORK.J19.
NOTE: The PROCEDURE PRINT printed page 2.
NOTE: PROCEDURE PRINT used (Total process time):
70
71 proc freq data= j19 ;
72 tables sickpay/list missing;
73 title1 'Sickpay Value of FY2019 Newly Reported Current Main JOBS';
74 title2 'Panel 23 Round 3 or 4 or Panel 24 Round 1 or 2 Records';
75 run;
NOTE: There were 8924 observations read from the data set WORK.J19.
NOTE: The PROCEDURE FREQ printed page 3.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.06 seconds
cpu time 0.03 seconds
76
77 title2;
78
79
80 *** c. ***
81 *** Select newly reported Panel 23 Current Main JOBS records from ***
82 *** the FY 2018 JOBS file and print selected variables from the ***
83 *** first 20 observations. ***;
84
85 data j18;
86 set jobs18.jobs18;
87 if subtype=1
88 and stillat=-1
89 and panel=23
90 and rn in (1,2);
91 run;
NOTE: There were 53323 observations read from the data set JOBS18.JOBS18.
NOTE: The data set WORK.J18 has 7774 observations and 85 variables.
NOTE: Compressing data set WORK.J18 decreased size by 7.14 percent.
Compressed is 39 pages; un-compressed would require 42 pages.
NOTE: DATA statement used (Total process time):
real time 0.81 seconds
cpu time 0.12 seconds
92
93
94 proc print data=j18 (obs=20);
95 title1 'Print Sample of Newly Reported Current Main JOBS';
96 title2 'Panel 23 Round 1 or 2 Records';
97 var jobidx panel rn subtype stillat sickpay;
98 run;
NOTE: There were 20 observations read from the data set WORK.J18.
NOTE: The PROCEDURE PRINT printed page 4.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
99
100 proc freq data=j18;
101 tables sickpay/list missing;
102 title1 'Sickpay Value of FY2018 Newly Reported Current Main JOBS';
103 title2 'Panel 23 Round 1 or 2 Records';
104 run;
NOTE: There were 7774 observations read from the data set WORK.J18.
NOTE: The PROCEDURE FREQ printed page 5.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
105
106
107 *** d. ***
108 *** Sort and merge datasets into J20R53F ***
109 *** Prepare FY2018, FY2019 and FY2020 data for merge ***;
110
111 proc sort data=j20r53;
112 by jobidx;
113 run;
NOTE: There were 7379 observations read from the data set WORK.J20R53.
NOTE: SAS sort was used.
NOTE: The data set WORK.J20R53 has 7379 observations and 84 variables.
NOTE: Compressing data set WORK.J20R53 decreased size by 5.13 percent.
Compressed is 37 pages; un-compressed would require 39 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.10 seconds
cpu time 0.03 seconds
114
115 proc sort data=j19;
116 by jobidx;
117 run;
NOTE: There were 8924 observations read from the data set WORK.J19.
NOTE: SAS sort was used.
NOTE: The data set WORK.J19 has 8924 observations and 84 variables.
NOTE: Compressing data set WORK.J19 decreased size by 6.38 percent.
Compressed is 44 pages; un-compressed would require 47 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
118
119 proc sort data=j18;
120 by jobidx;
121 run;
NOTE: There were 7774 observations read from the data set WORK.J18.
NOTE: SAS sort was used.
NOTE: The data set WORK.J18 has 7774 observations and 85 variables.
NOTE: Compressing data set WORK.J18 decreased size by 7.14 percent.
Compressed is 39 pages; un-compressed would require 42 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
122
123
124 *** e. ***
125 *** Create a dataset (J20R53F) that includes all variables ***
126 *** for the continuation Panel 23 Round 5 or Panel 24 Round 3 ***
127 *** Current Main JOBS and create the new variable SICKPAYX by ***
128 *** copying SICKPAY from the corresponding Round 1, Round 2, Round 3 ***
129 *** or Round 4 newly reported job record. Users may prefer to drop ***
130 *** "yy" variables at this point ***;
131
132 data j20r53f;
133 merge j20r53 (in=a)
134 j19 (in=b keep = jobidx sickpay rename=(sickpay=SICKPAY19))
135 j18 (in=c keep = jobidx sickpay rename=(sickpay=SICKPAY18));
136 by jobidx;
137
138 if a and b and SICKPAY19 ^= .
139 then SICKPAYX = SICKPAY19;
140
141 else if a and c and SICKPAY18 ^= .
142 then SICKPAYX = SICKPAY18;
143
144 if a and (b or c);
145 run;
NOTE: There were 7379 observations read from the data set WORK.J20R53.
NOTE: There were 8924 observations read from the data set WORK.J19.
NOTE: There were 7774 observations read from the data set WORK.J18.
NOTE: The data set WORK.J20R53F has 7377 observations and 87 variables.
NOTE: Compressing data set WORK.J20R53F decreased size by 5.00 percent.
Compressed is 38 pages; un-compressed would require 40 pages.
146
147 proc freq data=j20r53f;
148 tables panel*rn*sickpay*sickpayx/list missing;
149 title1 'Diagnostic Post-Merge - Sickpay * Sickpayx';
150 title2 'Panel 23 Round 5 or Panel 24 Round 3 Continuation Current Main JOBS ';
151 run;
NOTE: There were 7377 observations read from the data set WORK.J20R53F.
NOTE: The PROCEDURE FREQ printed page 6.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2320019102205 | 23 | 5 | 2 | 1 | 1 | -1 |
2 | 2320019103207 | 23 | 5 | 3 | 1 | 1 | -1 |
3 | 2320019104204 | 23 | 5 | 1 | 1 | 1 | -1 |
4 | 2320022103106 | 23 | 5 | 3 | 1 | 1 | -1 |
5 | 2320024102102 | 23 | 5 | 1 | 1 | 1 | -1 |
6 | 2320027102103 | 23 | 5 | 1 | 1 | 1 | -1 |
7 | 2320028102108 | 23 | 5 | 4 | 1 | 1 | -1 |
8 | 2320032101101 | 23 | 5 | 1 | 1 | 1 | -1 |
9 | 2320032102102 | 23 | 5 | 1 | 1 | 1 | -1 |
10 | 2320035101102 | 23 | 5 | 1 | 1 | 1 | -1 |
11 | 2320038101101 | 23 | 5 | 1 | 1 | 1 | -1 |
12 | 2320041101102 | 23 | 5 | 4 | 1 | 1 | -1 |
13 | 2320043101101 | 23 | 5 | 1 | 1 | 1 | -1 |
14 | 2320043102102 | 23 | 5 | 1 | 1 | 1 | -1 |
15 | 2320045101104 | 23 | 5 | 4 | 1 | 1 | -1 |
16 | 2320045102103 | 23 | 5 | 2 | 1 | 1 | -1 |
17 | 2320050101101 | 23 | 5 | 1 | 1 | 1 | -1 |
18 | 2320051101101 | 23 | 5 | 1 | 1 | 1 | -1 |
19 | 2320057101101 | 23 | 5 | 1 | 1 | 1 | -1 |
20 | 2320057102103 | 23 | 5 | 2 | 1 | 1 | -1 |
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2320002101202 | 23 | 3 | 1 | 1 | -1 | 2 |
2 | 2320002102102 | 23 | 4 | 4 | 1 | -1 | 2 |
3 | 2320006102201 | 23 | 4 | 4 | 1 | -1 | 2 |
4 | 2320019101103 | 23 | 3 | 3 | 1 | -1 | 2 |
5 | 2320019103207 | 23 | 3 | 3 | 1 | -1 | 2 |
6 | 2320022103106 | 23 | 3 | 3 | 1 | -1 | 2 |
7 | 2320028101105 | 23 | 3 | 3 | 1 | -1 | 1 |
8 | 2320028102108 | 23 | 4 | 4 | 1 | -1 | 1 |
9 | 2320028103107 | 23 | 3 | 3 | 1 | -1 | 2 |
10 | 2320034101104 | 23 | 3 | 3 | 1 | -1 | 1 |
11 | 2320034102105 | 23 | 3 | 3 | 1 | -1 | 2 |
12 | 2320034102108 | 23 | 4 | 4 | 1 | -1 | 2 |
13 | 2320034107107 | 23 | 3 | 3 | 1 | -1 | 1 |
14 | 2320036102103 | 23 | 4 | 4 | 1 | -1 | 2 |
15 | 2320041101102 | 23 | 4 | 4 | 1 | -1 | 2 |
16 | 2320045101104 | 23 | 4 | 4 | 1 | -1 | 1 |
17 | 2320069101103 | 23 | 3 | 3 | 1 | -1 | -1 |
18 | 2320074102103 | 23 | 3 | 3 | 1 | -1 | 2 |
19 | 2320091101104 | 23 | 4 | 4 | 1 | -1 | 1 |
20 | 2320102101102 | 23 | 3 | 3 | 1 | -1 | 1 |
SICKPAY | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
-8 | 276 | 3.09 | 276 | 3.09 |
-7 | 14 | 0.16 | 290 | 3.25 |
-1 | 1004 | 11.25 | 1294 | 14.50 |
1 | 4566 | 51.17 | 5860 | 65.67 |
2 | 3064 | 34.33 | 8924 | 100.00 |
Obs | JOBIDX | PANEL | RN | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|
1 | 2320002101201 | 23 | 1 | 1 | -1 | 2 |
2 | 2320002101203 | 23 | 2 | 1 | -1 | 2 |
3 | 2320002102101 | 23 | 1 | 1 | -1 | 1 |
4 | 2320003102102 | 23 | 1 | 1 | -1 | -8 |
5 | 2320008102101 | 23 | 1 | 1 | -1 | 1 |
6 | 2320019101101 | 23 | 1 | 1 | -1 | 1 |
7 | 2320019102203 | 23 | 1 | 1 | -1 | 2 |
8 | 2320019102205 | 23 | 2 | 1 | -1 | -1 |
9 | 2320019103201 | 23 | 1 | 1 | -1 | 2 |
10 | 2320019104204 | 23 | 1 | 1 | -1 | 1 |
11 | 2320022103103 | 23 | 1 | 1 | -1 | 2 |
12 | 2320022104104 | 23 | 1 | 1 | -1 | 2 |
13 | 2320022104105 | 23 | 2 | 1 | -1 | 1 |
14 | 2320024102102 | 23 | 1 | 1 | -1 | 1 |
15 | 2320027102103 | 23 | 1 | 1 | -1 | 1 |
16 | 2320028102102 | 23 | 1 | 1 | -1 | 2 |
17 | 2320032101101 | 23 | 1 | 1 | -1 | 1 |
18 | 2320032102102 | 23 | 1 | 1 | -1 | 1 |
19 | 2320034101101 | 23 | 1 | 1 | -1 | 1 |
20 | 2320034102102 | 23 | 1 | 1 | -1 | 2 |
SICKPAY | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
-8 | 246 | 3.16 | 246 | 3.16 |
-7 | 18 | 0.23 | 264 | 3.40 |
-1 | 921 | 11.85 | 1185 | 15.24 |
1 | 4066 | 52.30 | 5251 | 67.55 |
2 | 2523 | 32.45 | 7774 | 100.00 |
PANEL | RN | SICKPAY | SICKPAYX | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|---|---|---|
23 | 5 | -1 | -8 | 94 | 1.27 | 94 | 1.27 |
23 | 5 | -1 | -7 | 10 | 0.14 | 104 | 1.41 |
23 | 5 | -1 | -1 | 458 | 6.21 | 562 | 7.62 |
23 | 5 | -1 | 1 | 1969 | 26.69 | 2531 | 34.31 |
23 | 5 | -1 | 2 | 983 | 13.33 | 3514 | 47.63 |
24 | 3 | -1 | -8 | 73 | 0.99 | 3587 | 48.62 |
24 | 3 | -1 | -7 | 5 | 0.07 | 3592 | 48.69 |
24 | 3 | -1 | -1 | 517 | 7.01 | 4109 | 55.70 |
24 | 3 | -1 | 1 | 2254 | 30.55 | 6363 | 86.25 |
24 | 3 | -1 | 2 | 1014 | 13.75 | 7377 | 100.00 |