Appendix 2: Sample Stata Program
5 *** APP22.sas ***;
6
7 OPTIONS LS=132 PS=79;
8
9 *** ***
10 *** Program Name: SAMPLE.SAS ***
11 *** ***
12 *** Description: This job provides an example of how to get job info ***
13 *** from Round 1 or Round 2 in the FY2019 JOBS file ***
14 *** or Round 3 or Round 4 in the FY2020 JOBS file ***
15 *** or Round 5 or Round 6 in the FY2021 JOBS file when a ***
16 *** continuation current main job in the FY2022 JOBS file ***
17 *** is first reported in the FY2019, FY2020 or FY2021 ***
18 *** JOBS File. ***
19 *** ***
20 *** This example creates a dataset of continuation JOBS ***
21 *** records with a SICKPAYX variable copied from the ***
22 *** Round 1, 2, 3, 4, 5 or 6 newly reported job. ***
23 *** ***
24 *** **;
25
26 libname jobs19 "c:\mydata\jobs19";
27 libname jobs20 "c:\mydata\jobs20";
28 libname jobs21 "c:\mydata\jobs21";
29 libname jobs22 "c:\mydata\jobs22";
30
31
32 *** a.
33 *** Select continuing Panel 24 Round 7 or Panel 26 Round 3 ***
34 *** Current Main Jobs (SUBTYPE=1, STILLAT=1) from the FY 2022 JOBS file ***
35 *** and print selected variables from the first 20 observations ***;
36
37 data j22r73;
38 set jobs22.jobs22;
39 if ((panel=24 and rn=7 and origrnd<7)
40 or (panel=26 and rn=3 and origrnd<3))
41 and subtype=1
42 and stillat=1
43 and sickpay=-1
44 ;
45 run;
NOTE: There were 40074 observations read from the data set JOBS22.JOBS22.
NOTE: The data set WORK.J22R73 has 4703 observations and 85 variables.
NOTE: Compressing data set WORK.J22R73 decreased size by 3.85 percent.
Compressed is 25 pages; un-compressed would require 26 pages.
NOTE: DATA statement used (Total process time):
real time 6.77 seconds
cpu time 0.11 seconds
46
47 proc print data=j22r73 (obs=20);
48 title1 'Print Sample of Continuation Current Main Jobs';
49 title2 'Panel 24 Round 7 or Panel 26 Round 3 Records';
50 var jobidx panel rn origrnd subtype stillat sickpay;
51 run;
NOTE: There were 20 observations read from the data set WORK.J22R73.
NOTE: The PROCEDURE PRINT printed page 1.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.11 seconds
cpu time 0.04 seconds
52
53
54 *** b. ***
55 *** Select newly reported Panel 24 or Panel 26 Current Main Jobs ***
56 *** records from the FY 2021 JOBS file and print selected variables ***
57 *** from the first 20 observations. ***;
58
59 data j21;
60 set jobs21.jobs21;
61 if ((panel=24 and rn in (5,6))
62 or (panel=26 and rn in (1,2)))
63 and subtype=1
64 and stillat=-1
65 ;
66 run;
NOTE: There were 48353 observations read from the data set JOBS21.JOBS21.
NOTE: The data set WORK.J21 has 5135 observations and 86 variables.
NOTE: Compressing data set WORK.J21 decreased size by 3.57 percent.
Compressed is 27 pages; un-compressed would require 28 pages.
NOTE: DATA statement used (Total process time):
real time 2.67 seconds
cpu time 0.01 seconds
67
68 proc print data= j21 (obs=20);
69 title1 'Print Sample of Newly Reported Current Main Jobs';
70 title2 'Panel 24 Round 5 or 6 or Panel 26 Round 1 or 2 Records';
71 var jobidx panel rn origrnd subtype stillat sickpay;
72 run;
NOTE: There were 20 observations read from the data set WORK.J21.
NOTE: The PROCEDURE PRINT printed page 2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
73
74 proc freq data= j21 ;
75 tables sickpay/list missing;
76 title1 'Sickpay Value of FY2021 Newly Reported Current Main Jobs';
77 title2 'Panel 24 Round 5 or 6 or Panel 26 Round 1 or 2 Records';
78 run;
NOTE: There were 5135 observations read from the data set WORK.J21.
NOTE: The PROCEDURE FREQ printed page 3.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
79
80 title2;
81
82
83 *** c. ***
84 *** Select newly reported Panel 24 Current Main Jobs ***
85 *** records from the FY 2020 JOBS file and print selected variables ***
86 *** from the first 20 observations. ***;
87
88 data j20;
89 set jobs20.jobs20;
90 if panel=24
91 and rn in (3,4)
92 and subtype=1
93 and stillat=-1
94 ;
95 run;
NOTE: There were 47776 observations read from the data set JOBS20.JOBS20.
NOTE: The data set WORK.J20 has 1214 observations and 84 variables.
NOTE: Compressing data set WORK.J20 decreased size by 0.00 percent.
Compressed is 7 pages; un-compressed would require 7 pages.
NOTE: DATA statement used (Total process time):
real time 5.54 seconds
cpu time 0.01 seconds
96
97 proc print data= j20 (obs=20);
98 title1 'Print Sample of Newly Reported Current Main Jobs';
99 title2 'Panel 24 Round 3 or 4 Records';
100 var jobidx panel rn origrnd subtype stillat sickpay;
101 run;
NOTE: There were 20 observations read from the data set WORK.J20.
NOTE: The PROCEDURE PRINT printed page 4.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
102
103 proc freq data= j20;
104 tables sickpay/list missing;
105 title1 'Sickpay Value of FY2020 Newly Reported Current Main Jobs';
106 title2 'Panel 24 Round 3 or 4 Records';
107 run;
NOTE: There were 1214 observations read from the data set WORK.J20.
NOTE: The PROCEDURE FREQ printed page 5.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
108
109 title2;
110
111
112 *** d. ***
113 *** Select newly reported Panel 24 Current Main Jobs records from ***
114 *** the FY 2019 JOBS file and print selected variables from the ***
115 *** first 20 observations. ***;
116
117 data j19;
118 set jobs19.jobs19;
119 if subtype=1
120 and stillat=-1
121 and panel=24
122 and rn in (1,2);
123 run;
NOTE: There were 50334 observations read from the data set JOBS19.JOBS19.
NOTE: The data set WORK.J19 has 7101 observations and 84 variables.
NOTE: Compressing data set WORK.J19 decreased size by 5.41 percent.
Compressed is 35 pages; un-compressed would require 37 pages.
NOTE: DATA statement used (Total process time):
real time 2.93 seconds
cpu time 0.00 seconds
124
125
126 proc print data=j19 (obs=20);
127 title1 'Print Sample of Newly Reported Current Main Jobs';
128 title2 'Panel 24 Round 1 or 2 Records';
129 var jobidx panel rn origrnd subtype stillat sickpay;
130 run;
NOTE: There were 20 observations read from the data set WORK.J19.
NOTE: The PROCEDURE PRINT printed page 6.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
131
132 proc freq data=j19;
133 tables sickpay/list missing;
134 title1 'Sickpay Value of FY2019 Newly Reported Current Main Jobs';
135 title2 'Panel 24 Round 1 or 2 Records';
136 run;
NOTE: There were 7101 observations read from the data set WORK.J19.
NOTE: The PROCEDURE FREQ printed page 7.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
137
138
139 *** e. ***
140 *** Sort and merge datasets into j22r73F ***
141 *** Prepare FY2019, FY2020, FY2021 and FY2022 data for merge ***;
142
143 proc sort data=j22r73;
144 by jobidx;
145 run;
NOTE: There were 4703 observations read from the data set WORK.J22R73.
NOTE: SAS sort was used.
NOTE: The data set WORK.J22R73 has 4703 observations and 85 variables.
NOTE: Compressing data set WORK.J22R73 decreased size by 3.85 percent.
Compressed is 25 pages; un-compressed would require 26 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
146
147 proc sort data=j21;
148 by jobidx;
149 run;
NOTE: There were 5135 observations read from the data set WORK.J21.
NOTE: SAS sort was used.
NOTE: The data set WORK.J21 has 5135 observations and 86 variables.
NOTE: Compressing data set WORK.J21 decreased size by 3.57 percent.
Compressed is 27 pages; un-compressed would require 28 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
150
151 proc sort data=j20;
152 by jobidx;
153 run;
NOTE: There were 1214 observations read from the data set WORK.J20.
NOTE: SAS sort was used.
NOTE: The data set WORK.J20 has 1214 observations and 84 variables.
NOTE: Compressing data set WORK.J20 decreased size by 0.00 percent.
Compressed is 7 pages; un-compressed would require 7 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 7101 observations read from the data set WORK.J19.
NOTE: SAS sort was used.
NOTE: The data set WORK.J19 has 7101 observations and 84 variables.
NOTE: Compressing data set WORK.J19 decreased size by 5.41 percent.
Compressed is 35 pages; un-compressed would require 37 pages.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
158
159
160 *** f. ***
161 *** Create a dataset (j22r73F) that includes all variables for the ***
162 *** continuation Panel 24 Round 7 or Panel 26 Round 3 ***
163 *** Current Main Jobs and create the new variable SICKPAYX by ***
164 *** copying SICKPAY from the corresponding Round 1, Round 2, Round 3, ***
165 *** Round 4, Round 5 or Round 6 newly reported job record. Users may ***
166 *** prefer to drop "yy" variables at this point ***;
167
168 data out.j22r73f j22r73f;
169 merge j22r73 (in=a)
170 j21 (in=b keep = jobidx sickpay rename=(sickpay=SICKPAY21))
171 j20 (in=c keep = jobidx sickpay rename=(sickpay=SICKPAY20))
172 j19 (in=d keep = jobidx sickpay rename=(sickpay=SICKPAY19));
173 by jobidx;
174
175 if a and b and SICKPAY21 ^= .
176 then SICKPAYX = SICKPAY21;
177
178 else if a and c and SICKPAY20 ^= .
179 then SICKPAYX = SICKPAY20;
180
181 else if a and d and SICKPAY19 ^= .
182 then SICKPAYX = SICKPAY19;
183
184 if a and (b or c or d);
185 run;
NOTE: There were 4703 observations read from the data set WORK.J22R73.
NOTE: There were 5135 observations read from the data set WORK.J21.
NOTE: There were 1214 observations read from the data set WORK.J20.
NOTE: There were 7101 observations read from the data set WORK.J19.
NOTE: The data set OUT.J22R73F has 4701 observations and 89 variables.
NOTE: Compressing data set OUT.J22R73F decreased size by 3.70 percent.
Compressed is 26 pages; un-compressed would require 27 pages.
NOTE: The data set WORK.J22R73F has 4701 observations and 89 variables.
NOTE: Compressing data set WORK.J22R73F decreased size by 3.70 percent.
Compressed is 26 pages; un-compressed would require 27 pages.
NOTE: DATA statement used (Total process time):
real time 1.30 seconds
cpu time 0.07 seconds
186
187 proc freq data=j22r73f;
188 tables panel*rn*sickpay*sickpayx/list missing;
189 title1 'Diagnostic Post-Merge - Sickpay * Sickpayx';
190 title2 'Panel 24 Round 7 or Panel 26 Round 3 Continuation Current Main Jobs ';
191 run;
NOTE: There were 4701 observations read from the data set WORK.J22R73F.
NOTE: The PROCEDURE FREQ printed page 8.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2460006102102 | 24 | 7 | 1 | 1 | 1 | -1 |
2 | 2460018101103 | 24 | 7 | 5 | 1 | 1 | -1 |
3 | 2460024101102 | 24 | 7 | 2 | 1 | 1 | -1 |
4 | 2460026101101 | 24 | 7 | 1 | 1 | 1 | -1 |
5 | 2460029101101 | 24 | 7 | 1 | 1 | 1 | -1 |
6 | 2460040101101 | 24 | 7 | 1 | 1 | 1 | -1 |
7 | 2460041101101 | 24 | 7 | 1 | 1 | 1 | -1 |
8 | 2460041102102 | 24 | 7 | 1 | 1 | 1 | -1 |
9 | 2460052101101 | 24 | 7 | 1 | 1 | 1 | -1 |
10 | 2460068101102 | 24 | 7 | 2 | 1 | 1 | -1 |
11 | 2460085101103 | 24 | 7 | 6 | 1 | 1 | -1 |
12 | 2460102101104 | 24 | 7 | 5 | 1 | 1 | -1 |
13 | 2460102102103 | 24 | 7 | 1 | 1 | 1 | -1 |
14 | 2460108102102 | 24 | 7 | 1 | 1 | 1 | -1 |
15 | 2460114102101 | 24 | 7 | 1 | 1 | 1 | -1 |
16 | 2460116101103 | 24 | 7 | 6 | 1 | 1 | -1 |
17 | 2460123107201 | 24 | 7 | 1 | 1 | 1 | -1 |
18 | 2460125101101 | 24 | 7 | 1 | 1 | 1 | -1 |
19 | 2460126101105 | 24 | 7 | 6 | 1 | 1 | -1 |
20 | 2460132101101 | 24 | 7 | 1 | 1 | 1 | -1 |
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2460018101103 | 24 | 5 | 5 | 1 | -1 | 1 |
2 | 2460056108102 | 24 | 6 | 6 | 1 | -1 | 1 |
3 | 2460085101103 | 24 | 6 | 6 | 1 | -1 | 2 |
4 | 2460102101104 | 24 | 5 | 5 | 1 | -1 | 2 |
5 | 2460114103104 | 24 | 6 | 6 | 1 | -1 | 2 |
6 | 2460116101102 | 24 | 5 | 1 | 1 | -1 | 1 |
7 | 2460116101103 | 24 | 6 | 6 | 1 | -1 | 2 |
8 | 2460126101105 | 24 | 6 | 6 | 1 | -1 | 2 |
9 | 2460129102203 | 24 | 5 | 5 | 1 | -1 | -1 |
10 | 2460140103203 | 24 | 6 | 6 | 1 | -1 | 2 |
11 | 2460140201202 | 24 | 5 | 5 | 1 | -1 | 1 |
12 | 2460140201204 | 24 | 6 | 6 | 1 | -1 | 2 |
13 | 2460157105106 | 24 | 6 | 6 | 1 | -1 | 1 |
14 | 2460158101102 | 24 | 6 | 6 | 1 | -1 | 2 |
15 | 2460164101104 | 24 | 6 | 6 | 1 | -1 | 2 |
16 | 2460164201202 | 24 | 6 | 6 | 1 | -1 | 2 |
17 | 2460164301302 | 24 | 6 | 6 | 1 | -1 | 1 |
18 | 2460165201204 | 24 | 5 | 5 | 1 | -1 | 1 |
19 | 2460180102103 | 24 | 5 | 5 | 1 | -1 | 1 |
20 | 2460208104106 | 24 | 5 | 5 | 1 | -1 | -8 |
SICKPAY | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
-8 | 227 | 4.42 | 227 | 4.42 |
-7 | 18 | 0.35 | 245 | 4.77 |
-1 | 668 | 13.01 | 913 | 17.78 |
1 | 2812 | 54.76 | 3725 | 72.54 |
2 | 1410 | 27.46 | 5135 | 100.00 |
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2460004102104 | 24 | 3 | 3 | 1 | -1 | -1 |
2 | 2460010101103 | 24 | 3 | 3 | 1 | -1 | 1 |
3 | 2460032103105 | 24 | 3 | 1 | 1 | -1 | 1 |
4 | 2460062102106 | 24 | 3 | 3 | 1 | -1 | -1 |
5 | 2460092101104 | 24 | 3 | 3 | 1 | -1 | 1 |
6 | 2460092102106 | 24 | 4 | 4 | 1 | -1 | 1 |
7 | 2460093101104 | 24 | 3 | 3 | 1 | -1 | 2 |
8 | 2460093103103 | 24 | 3 | 3 | 1 | -1 | 1 |
9 | 2460136102104 | 24 | 3 | 3 | 1 | -1 | 1 |
10 | 2460140103201 | 24 | 3 | 3 | 1 | -1 | -8 |
11 | 2460144102106 | 24 | 4 | 4 | 1 | -1 | 1 |
12 | 2460144104107 | 24 | 4 | 4 | 1 | -1 | 1 |
13 | 2460157106104 | 24 | 3 | 3 | 1 | -1 | -8 |
14 | 2460164101102 | 24 | 3 | 1 | 1 | -1 | 2 |
15 | 2460164101103 | 24 | 4 | 4 | 1 | -1 | 2 |
16 | 2460165201202 | 24 | 3 | 3 | 1 | -1 | 2 |
17 | 2460165201203 | 24 | 4 | 4 | 1 | -1 | 2 |
18 | 2460223102101 | 24 | 4 | 4 | 1 | -1 | -8 |
19 | 2460223103102 | 24 | 4 | 4 | 1 | -1 | -8 |
20 | 2460223104105 | 24 | 4 | 4 | 1 | -1 | -8 |
SICKPAY | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
-8 | 72 | 5.93 | 72 | 5.93 |
-7 | 2 | 0.16 | 74 | 6.10 |
-1 | 125 | 10.30 | 199 | 16.39 |
1 | 466 | 38.39 | 665 | 54.78 |
2 | 549 | 45.22 | 1214 | 100.00 |
Obs | JOBIDX | PANEL | RN | ORIGRND | SUBTYPE | STILLAT | SICKPAY |
---|---|---|---|---|---|---|---|
1 | 2460001101101 | 24 | 1 | 1 | 1 | -1 | 1 |
2 | 2460004101101 | 24 | 1 | 1 | 1 | -1 | -1 |
3 | 2460004102103 | 24 | 2 | 2 | 1 | -1 | -1 |
4 | 2460005101101 | 24 | 1 | 1 | 1 | -1 | 1 |
5 | 2460005102102 | 24 | 1 | 1 | 1 | -1 | 1 |
6 | 2460005102103 | 24 | 2 | 2 | 1 | -1 | 1 |
7 | 2460006102102 | 24 | 1 | 1 | 1 | -1 | 2 |
8 | 2460007101101 | 24 | 1 | 1 | 1 | -1 | 1 |
9 | 2460010102101 | 24 | 1 | 1 | 1 | -1 | 1 |
10 | 2460014101101 | 24 | 1 | 1 | 1 | -1 | 1 |
11 | 2460018101101 | 24 | 1 | 1 | 1 | -1 | 1 |
12 | 2460024101101 | 24 | 1 | 1 | 1 | -1 | 2 |
13 | 2460024101102 | 24 | 2 | 2 | 1 | -1 | 2 |
14 | 2460026101101 | 24 | 1 | 1 | 1 | -1 | 1 |
15 | 2460027101101 | 24 | 1 | 1 | 1 | -1 | 1 |
16 | 2460027102102 | 24 | 1 | 1 | 1 | -1 | 1 |
17 | 2460029101101 | 24 | 1 | 1 | 1 | -1 | 1 |
18 | 2460031101101 | 24 | 1 | 1 | 1 | -1 | 1 |
19 | 2460032101101 | 24 | 1 | 1 | 1 | -1 | 1 |
20 | 2460032102103 | 24 | 1 | 1 | 1 | -1 | 1 |
SICKPAY | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
-8 | 180 | 2.53 | 180 | 2.53 |
-7 | 12 | 0.17 | 192 | 2.70 |
-1 | 842 | 11.86 | 1034 | 14.56 |
1 | 3867 | 54.46 | 4901 | 69.02 |
2 | 2200 | 30.98 | 7101 | 100.00 |
PANEL | RN | SICKPAY | SICKPAYX | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|---|---|---|
24 | 7 | -1 | -8 | 52 | 1.11 | 52 | 1.11 |
24 | 7 | -1 | -7 | 4 | 0.09 | 56 | 1.19 |
24 | 7 | -1 | -1 | 296 | 6.30 | 352 | 7.49 |
24 | 7 | -1 | 1 | 1179 | 25.08 | 1531 | 32.57 |
24 | 7 | -1 | 2 | 515 | 10.96 | 2046 | 43.52 |
26 | 3 | -1 | -8 | 82 | 1.74 | 2128 | 45.27 |
26 | 3 | -1 | -7 | 7 | 0.15 | 2135 | 45.42 |
26 | 3 | -1 | -1 | 391 | 8.32 | 2526 | 53.73 |
26 | 3 | -1 | 1 | 1638 | 34.84 | 4164 | 88.58 |
26 | 3 | -1 | 2 | 537 | 11.42 | 4701 | 100.00 |