Appendix 2: Sample Stata Program
8 *** APP21.sas ***;
9
10 OPTIONS LS=132 PS=79;
11
12 *** ***
13 *** Program Name: SAMPLE.SAS ***
14 *** ***
15 *** Description: This job provides an example of how to get job info ***
16 *** from Round 1 or Round 2 in the FY2018 JOBS file ***
17 *** or Round 3 or Round 4 in the FY2019 JOBS file ***
18 *** or Round 5 or Round 6 in the FY2020 JOBS file when a ***
19 *** continuation current main job in the FY2021 JOBS file ***
20 *** is first reported in the FY2018, FY2019 or FY2020 ***
22 *** ***
23 *** This example creates a dataset of continuation JOBS ***
24 *** records with a SICKPAYX variable copied from the ***
25 *** Round 1, 2, 3, 4, 5 or 6 newly reported job. ***
26 *** ***
27 ;
28
29 libname jobs18 "c:\mydata\jobs18";
30 libname jobs19 "c:\mydata\jobs19";
31 libname jobs20 "c:\mydata\jobs20";
32 libname jobs21 "c:\mydata\jobs21";
33
34 *** a. ***
35 *** Select continuing Panel 23 Round 7 or Panel 24 Round 5 or Panel 25 Round 3 ***
36 *** Current Main Jobs (SUBTYPE=1, STILLAT=1) from the FY 2021 JOBS file ***
37 *** and print selected variables from the first 20 observations ***;
38
39 data j21r753;
40 set jobs21.jobs21;
41 if ((panel=23 and rn=7 and origrnd<7)
42 or (panel=24 and rn=5 and origrnd<5)
43 or (panel=25 and rn=3 and origrnd<3))
44 and subtype=1
45 and stillat=1
46 and sickpay=-1
47 ;
48 run;
NOTE: There were 48353 observations read from the data set JOBS21.JOBS21.
NOTE: The data set WORK.J21R753 has 7290 observations and 86 variables.
NOTE: Compressing data set WORK.J21R753 decreased size by 5.00 percent.
Compressed is 38 pages; un-compressed would require 40 pages.
NOTE: DATA statement used (Total process time):
real time 1.21 seconds
cpu time 0.14 seconds
49
50 proc print data=j21r753 (obs=20);
51 title1 'Print Sample of Continuation Current Main Jobs';
52 title2 'Panel 23 Round 7 or Panel 24 Round 5 or Panel 25 Round 3 Records';
53 var jobidx panel rn origrnd subtype stillat sickpay;
54 run;
NOTE: There were 20 observations read from the data set WORK.J21R753.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
55
56
57 *** b. ***
58 *** Select newly reported Panel 23 or Panel 24 or Panel 25 Current Main Jobs ***
59 *** records from the FY 2020 JOBS file and print selected variables ***
60 *** from the first 20 observations. ***;
61
62 data j20;
63 set jobs20.jobs20;
64 if ((panel=23 and rn in (5,6))
65 or (panel=24 and rn in (3,4))
66 or (panel=25 and rn in (1,2)))
67 and subtype=1
68 and stillat=-1
69 ;
70 run;
NOTE: There were 47776 observations read from the data set JOBS20.JOBS20.
NOTE: The data set WORK.J20 has 6456 observations and 84 variables.
NOTE: Compressing data set WORK.J20 decreased size by 2.94 percent.
Compressed is 33 pages; un-compressed would require 34 pages.
NOTE: DATA statement used (Total process time):
real time 2.46 seconds
cpu time 0.03 seconds
71
72 proc print data= j20 (obs=20);
73 title1 'Print Sample of Newly Reported Current Main Jobs';
74 title2 'Panel 23 Round 5 or 6 or Panel 24 Round 3 or 4 or Panel 25 Round 1 or 2 Records';
75 var jobidx panel rn origrnd subtype stillat sickpay;
76 run;
NOTE: There were 20 observations read from the data set WORK.J20.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
77
78 proc freq data= j20 ;
79 tables sickpay/list missing;
80 title1 'Sickpay Value of FY2020 Newly Reported Current Main Jobs';
81 title2 'Panel 23 Round 5 or 6 or Panel 24 Round 3 or 4 or Panel 25 Round 1 or 2 Records';
82 run;
NOTE: There were 6456 observations read from the data set WORK.J20.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
83
84 title2;
85
86
87 *** c. ***
88 *** Select newly reported Panel 23 or Panel 24 Current Main Jobs ***
89 *** records from the FY 2019 JOBS file and print selected variables ***
90 *** from the first 20 observations. ***;
91
92 data j19;
93 set jobs19.jobs19;
94 if ((panel=23 and rn in (3,4))
95 or (panel=24 and rn in (1,2)))
96 and subtype=1
97 and stillat=-1
98 ;
99 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 2.16 seconds
cpu time 0.06 seconds
100
101 proc print data= j19 (obs=20);
102 title1 'Print Sample of Newly Reported Current Main Jobs';
103 title2 'Panel 23 Round 3 or 4 or Panel 24 Round 1 or 2 Records';
104 var jobidx panel rn origrnd subtype stillat sickpay;
105 run;
NOTE: There were 20 observations read from the data set WORK.J19.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
106
107 proc freq data= j19 ;
108 tables sickpay/list missing;
109 title1 'Sickpay Value of FY2019 Newly Reported Current Main Jobs';
110 title2 'Panel 23 Round 3 or 4 or Panel 24 Round 1 or 2 Records';
111 run;
NOTE: There were 8924 observations read from the data set WORK.J19.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.02 seconds
cpu time 0.03 seconds
112
113 title2;
114
115
116 *** d. ***
117 *** Select newly reported Panel 23 Current Main Jobs records from ***
118 *** the FY 2018 JOBS file and print selected variables from the ***
119 *** first 20 observations. ***;
120
121 data j18;
122 set jobs18.jobs18;
123 if subtype=1
124 and stillat=-1
125 and panel=23
126 and rn in (1,2);
127 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 1.32 seconds
cpu time 0.12 seconds
128
129
130 proc print data=j18 (obs=20);
131 title1 'Print Sample of Newly Reported Current Main Jobs';
132 title2 'Panel 23 Round 1 or 2 Records';
133 var jobidx panel rn subtype stillat sickpay;
134 run;
NOTE: There were 20 observations read from the data set WORK.J18.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
135
136 proc freq data=j18;
137 tables sickpay/list missing;
138 title1 'Sickpay Value of FY2018 Newly Reported Current Main Jobs';
139 title2 'Panel 23 Round 1 or 2 Records';
140 run;
NOTE: There were 7774 observations read from the data set WORK.J18.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
141
142
143 *** e. ***
144 *** Sort and merge datasets into J21R753F ***
145 *** Prepare FY2018, FY2019, FY2020 and FY2021 data for merge ***;
146
147 proc sort data=j21r753;
148 by jobidx;
149 run;
NOTE: There were 7290 observations read from the data set WORK.J21R753.
NOTE: SAS sort was used.
NOTE: The data set WORK.J21R753 has 7290 observations and 86 variables.
NOTE: Compressing data set WORK.J21R753 decreased size by 5.00 percent.
Compressed is 38 pages; un-compressed would require 40 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
150
151 proc sort data=j20;
152 by jobidx;
153 run;
NOTE: There were 6456 observations read from the data set WORK.J20.
NOTE: SAS sort was used.
NOTE: The data set WORK.J20 has 6456 observations and 84 variables.
NOTE: Compressing data set WORK.J20 decreased size by 2.94 percent.
Compressed is 33 pages; un-compressed would require 34 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
154
155 proc sort data=j19;
156 by jobidx;
157 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.02 seconds
cpu time 0.03 seconds
158
159 proc sort data=j18;
160 by jobidx;
161 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.03 seconds
cpu time 0.03 seconds
162
163
164 *** f. ***
165 *** Create a dataset (J21R753F) that includes all variables for the ***
166 *** continuation Panel 23 Round 7 or Panel 24 Round 5 or Panel 25 Round 3 ***
167 *** Current Main Jobs and create the new variable SICKPAYX by ***
168 *** copying SICKPAY from the corresponding Round 1, Round 2, Round 3, ***
169 *** Round 4, Round 5 or Round 6 newly reported job record. Users may ***
170 *** prefer to drop "yy" variables at this point ***;
171
172 data j21r753f;
173 merge j21r753 (in=a)
174 j20 (in=b keep = jobidx sickpay rename=(sickpay=SICKPAY20))
175 j19 (in=c keep = jobidx sickpay rename=(sickpay=SICKPAY19))
176 j18 (in=d keep = jobidx sickpay rename=(sickpay=SICKPAY18));
177 by jobidx;
178
179 if a and b and SICKPAY20 ^= .
180 then SICKPAYX = SICKPAY20;
181
182 else if a and c and SICKPAY19 ^= .
183 then SICKPAYX = SICKPAY19;
184
185 else if a and d and SICKPAY18 ^= .
186 then SICKPAYX = SICKPAY18;
187
188 if a and (b or c or d);
189 run;
NOTE: There were 7290 observations read from the data set WORK.J21R753.
NOTE: There were 6456 observations read from the data set WORK.J20.
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.J21R753F has 7289 observations and 90 variables.
NOTE: Compressing data set WORK.J21R753F decreased size by 4.76 percent.
Compressed is 40 pages; un-compressed would require 42 pages.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
190
191 proc freq data=j21r753f;
192 tables panel*rn*sickpay*sickpayx/list missing;
193 title1 'Diagnostic Post-Merge - Sickpay * Sickpayx';
194 title2 'Panel 23 Round 7 or Panel 24 Round 5 or Panel 25 Round 3 Continuation Current Main Jobs ';
195 run;
NOTE: There were 7289 observations read from the data set WORK.J21R753F.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2320022103106 | 23 | 7 | 3 | 1 | 1 | -1 |
2 | 2320024102102 | 23 | 7 | 1 | 1 | 1 | -1 |
3 | 2320027102103 | 23 | 7 | 1 | 1 | 1 | -1 |
4 | 2320038101101 | 23 | 7 | 1 | 1 | 1 | -1 |
5 | 2320041101102 | 23 | 7 | 4 | 1 | 1 | -1 |
6 | 2320043102102 | 23 | 7 | 1 | 1 | 1 | -1 |
7 | 2320045101104 | 23 | 7 | 4 | 1 | 1 | -1 |
8 | 2320045102103 | 23 | 7 | 2 | 1 | 1 | -1 |
9 | 2320050101101 | 23 | 7 | 1 | 1 | 1 | -1 |
10 | 2320051101101 | 23 | 7 | 1 | 1 | 1 | -1 |
11 | 2320057101101 | 23 | 7 | 1 | 1 | 1 | -1 |
12 | 2320057102103 | 23 | 7 | 2 | 1 | 1 | -1 |
13 | 2320063102102 | 23 | 7 | 1 | 1 | 1 | -1 |
14 | 2320065102202 | 23 | 7 | 5 | 1 | 1 | -1 |
15 | 2320074102103 | 23 | 7 | 3 | 1 | 1 | -1 |
16 | 2320075101101 | 23 | 7 | 1 | 1 | 1 | -1 |
17 | 2320078101101 | 23 | 7 | 1 | 1 | 1 | -1 |
18 | 2320081101101 | 23 | 7 | 1 | 1 | 1 | -1 |
19 | 2320081103102 | 23 | 7 | 1 | 1 | 1 | -1 |
20 | 2320091101104 | 23 | 7 | 4 | 1 | 1 | -1 |
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2320006102204 | 23 | 5 | 5 | 1 | -1 | 1 |
2 | 2320006102203 | 23 | 6 | 6 | 1 | -1 | 2 |
3 | 2320019103301 | 23 | 6 | 6 | 1 | -1 | -8 |
4 | 2320065102202 | 23 | 5 | 5 | 1 | -1 | 1 |
5 | 2320069101104 | 23 | 6 | 3 | 1 | -1 | 2 |
6 | 2320112104103 | 23 | 6 | 6 | 1 | -1 | 2 |
7 | 2320123102103 | 23 | 5 | 5 | 1 | -1 | 2 |
8 | 2320125103104 | 23 | 5 | 5 | 1 | -1 | 2 |
9 | 2320134102105 | 23 | 5 | 5 | 1 | -1 | 1 |
10 | 2320149101103 | 23 | 5 | 5 | 1 | -1 | -1 |
11 | 2320158101106 | 23 | 5 | 5 | 1 | -1 | -1 |
12 | 2320184102105 | 23 | 6 | 6 | 1 | -1 | -1 |
13 | 2320206101103 | 23 | 5 | 5 | 1 | -1 | 1 |
14 | 2320221104407 | 23 | 5 | 5 | 1 | -1 | 1 |
15 | 2320222101068 | 23 | 6 | 6 | 1 | -1 | 1 |
16 | 2320229103201 | 23 | 5 | 5 | 1 | -1 | -1 |
17 | 2320271101102 | 23 | 5 | 5 | 1 | -1 | 2 |
18 | 2320271102103 | 23 | 5 | 5 | 1 | -1 | 2 |
19 | 2320279102105 | 23 | 6 | 6 | 1 | -1 | 1 |
20 | 2320280104301 | 23 | 5 | 5 | 1 | -1 | 1 |
SICKPAY | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
-8 | 230 | 3.56 | 230 | 3.56 |
-7 | 9 | 0.14 | 239 | 3.70 |
-1 | 791 | 12.25 | 1030 | 15.95 |
1 | 3210 | 49.72 | 4240 | 65.68 |
2 | 2216 | 34.32 | 6456 | 100.00 |
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 | 7 | -1 | -8 | 73 | 1.00 | 73 | 1.00 |
23 | 7 | -1 | -7 | 9 | 0.12 | 82 | 1.12 |
23 | 7 | -1 | -1 | 344 | 4.72 | 426 | 5.84 |
23 | 7 | -1 | 1 | 1426 | 19.56 | 1852 | 25.41 |
23 | 7 | -1 | 2 | 698 | 9.58 | 2550 | 34.98 |
24 | 5 | -1 | -8 | 53 | 0.73 | 2603 | 35.71 |
24 | 5 | -1 | -7 | 3 | 0.04 | 2606 | 35.75 |
24 | 5 | -1 | -1 | 350 | 4.80 | 2956 | 40.55 |
24 | 5 | -1 | 1 | 1447 | 19.85 | 4403 | 60.41 |
24 | 5 | -1 | 2 | 610 | 8.37 | 5013 | 68.77 |
25 | 3 | -1 | -8 | 43 | 0.59 | 5056 | 69.36 |
25 | 3 | -1 | -1 | 328 | 4.50 | 5384 | 73.86 |
25 | 3 | -1 | 1 | 1402 | 19.23 | 6786 | 93.10 |
25 | 3 | -1 | 2 | 503 | 6.90 | 7289 | 100 |