Appendix 1: Sample SAS Program
libname jobs18 "c:\mydata\jobs18";
libname jobs19 "c:\mydata\jobs19";
libname jobs20 "c:\mydata\jobs20";
libname jobs21 "c:\mydata\jobs21";
proc export data=jobs18.jobs18 outfile= jobs18.dta;
run;
proc export data=jobs19.jobs19 outfile= jobs19.dta;
run;
proc export data=jobs20.jobs20 outfile= jobs20.dta;
run;
proc export data=jobs21.jobs21 outfile= jobs21.dta;
run;
*#delimit ;
set linesize 100
log using "c:\mydata\APPdofile.log", replace
use "c:\mydata\jobs20.dta", clear
format PANEL SUBTYPE STILLAT SICKPAY %3.0f
keep if (PANEL==23 & RN==5 & ORIGRND < 5 & SUBTYPE==1 & STILLAT==1 & SICKPAY==-1) | (PANEL==24 & RN==3 & ORIGRND < 3 & SUBTYPE==1 & STILLAT==1 & SICKPAY==-1)
asdoc list JOBIDX PANEL RN ORIGRND SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(0) noobs, save(stata_output.doc) title(Print Sample of Continuation P23 R5 or P24 R3 Records)
sort JOBIDX
save "c:\mydata\j20.dta", replace
use "c:\mydata\jobs19.dta", clear
format PANEL SUBTYPE STILLAT SICKPAY %3.0f
keep if ((PANEL==23 & (RN==3 | RN==4) ) | (PANEL==24 & (RN==1 | RN==2))) & SUBTYPE==1 & STILLAT==-1
asdoc list JOBIDX PANEL RN ORIGRND SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(0) noobs, save(stata_output.doc) title(Print Sample of Newly Reported P23 R3 or 4 and P24 R1 or 2 Records)
sort JOBIDX
rename SICKPAY SICKPAY19
keep JOBIDX SICKPAY19
save "c:\mydata\j19.dta", replace
asdoc tabulate SICKPAY19, font(arial) fs(8), save(stata_output.doc) title(Sickpay Value of FY2019 P23 R3 or 4 and P24 R 1 or 2 Newly Reported CMJs)
use "c:\mydata\jobs18.dta", clear
format PANEL SUBTYPE STILLAT SICKPAY %3.0f
keep if PANEL==23 & (RN==1 | RN==2) & SUBTYPE==1 & STILLAT==-1
asdoc list JOBIDX PANEL RN SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(0) noobs, save(stata_output.doc) title(Print Sample of Newly Reported P23 R1 or 2 Records)
sort JOBIDX
rename SICKPAY SICKPAY18
keep JOBIDX SICKPAY18
save "c:\mydata\j18.dta", replace
asdoc tabulate SICKPAY18, font(arial) fs(8), save(stata_output.doc) title(Sickpay Value of FY2018 P23 R1 or 2 Newly Reported CMJs)
use "c:\mydata\j20.dta", clear
merge 1:m JOBIDX using "c:\mydata\j19.dta", generate(matchvar19)
gen SICKPAYX = .
keep if matchvar19 == 1 | matchvar19 == 3
replace SICKPAYX = SICKPAY19 if SICKPAY19 != .
merge 1:m JOBIDX using "c:\mydata\j18.dta", generate(matchvar18)
keep if matchvar18 == 3 | matchvar19 == 3
replace SICKPAYX = SICKPAY18 if SICKPAY19 == .
save "c:\mydata\j20r53f.dta", replace
asdoc tabulate SICKPAY SICKPAYX, save(stata_output.doc) font(arial) fs(8) title(Diagnostic Post-Merge - Sickpay * Sickpayx)
log close
name: <unnamed>
log: c:\mydata\APPdofile.log
log type: text
.
.
. use "c:\mydata\jobs21.dta", clear
.
. format PANEL ORIGRND SUBTYPE STILLAT SICKPAY %3.0f
.
. keep if (PANEL==23 & RN==7 & ORIGRND < 7 & SUBTYPE==1 & STILLAT==1 & SICKPAY==-1) | (PANEL==24 & R
> N==5 & ORIGRND < 5 & SUBTYPE==1 & STILLAT==1 & SICKPAY==-1) | (PANEL==25 & RN==3 & ORIGRND < 3 & S
> UBTYPE==1 & STILLAT==1 & SICKPAY==-1)
(41,063 observations deleted)
.
. asdoc list JOBIDX PANEL RN ORIGRND SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(
> 0) noobs, save(stata_output.doc) title(Print Sample of Continuation P23 R7 or P24 R5 or P25 R3 Rec
> ords)
(File stata_output.doc already exists, option append was assumed)
.
. sort JOBIDX
.
. save "c:\mydata\j21.dta", replace
file c:\mydata\j21.dta saved
.
.
.
. use "c:\mydata\jobs20.dta", clear
.
. format PANEL ORIGRND SUBTYPE STILLAT SICKPAY %3.0f
.
. keep if ((PANEL==23 & (RN==5 | RN==6) ) | (PANEL==24 & (RN==3 | RN==4) ) | (PANEL==25 & (RN==1 | R
> N==2))) & SUBTYPE==1 & STILLAT==-1
(41,320 observations deleted)
.
.
. asdoc list JOBIDX PANEL RN ORIGRND SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(
> 0) noobs, save(stata_output.doc) title(Print Sample of Newly Reported P23 R5 or 6 and P24 R3 or 4
> and P25 R1 or 2 Records)
(File stata_output.doc already exists, option append was assumed)
.
. sort JOBIDX
.
. rename SICKPAY SICKPAY20
.
. keep JOBIDX SICKPAY20
.
. save "c:\mydata\j20.dta", replace
file c:\mydata\j20.dta saved
.
.
. asdoc tabulate SICKPAY20, font(arial) fs(8), save(stata_output.doc) title(Sickpay Value of FY2020
> P23 R5 or 6 and P24 R3 or 4 and P25 R 1 or 2 Newly Reported CMJs)
(File stata_output.doc already exists, option append was assumed)
.
.
.
. use "c:\mydata\jobs19.dta", clear
.
. format PANEL ORIGRND SUBTYPE STILLAT SICKPAY %3.0f
.
. keep if ((PANEL==23 & (RN==3 | RN==4) ) | (PANEL==24 & (RN==1 | RN==2))) & SUBTYPE==1 & STILLAT==-
> 1
(41,410 observations deleted)
.
.
. asdoc list JOBIDX PANEL RN ORIGRND SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(
> 0) noobs, save(stata_output.doc) title(Print Sample of Newly Reported P23 R3 or 4 and P24 R1 or 2
> Records)
(File stata_output.doc already exists, option append was assumed)
.
. sort JOBIDX
.
. rename SICKPAY SICKPAY19
.
. keep JOBIDX SICKPAY19
.
. save "c:\mydata\j19.dta", replace
file c:\mydata\j19.dta saved
.
.
. asdoc tabulate SICKPAY19, font(arial) fs(8), save(stata_output.doc) title(Sickpay Value of FY2019
> P23 R3 or 4 and P24 R 1 or 2 Newly Reported CMJs)
(File stata_output.doc already exists, option append was assumed)
.
.
.
. use "c:\mydata\jobs18.dta", clear
.
. format PANEL SUBTYPE STILLAT SICKPAY %3.0f
.
. keep if PANEL==23 & (RN==1 | RN==2) & SUBTYPE==1 & STILLAT==-1
(45,549 observations deleted)
.
.
. asdoc list JOBIDX PANEL RN SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(0) noobs
> , save(stata_output.doc) title(Print Sample of Newly Reported P23 R1 or 2 Records)
(File stata_output.doc already exists, option append was assumed)
.
.
. sort JOBIDX
.
. rename SICKPAY SICKPAY18
.
. keep JOBIDX SICKPAY18
.
. save "c:\mydata\j18.dta", replace
(note: file c:\mydata\j18.dta not found)
file c:\mydata\j18.dta saved
.
. asdoc tabulate SICKPAY18, font(arial) fs(8), save(stata_output.doc) title(Sickpay Value of FY2018
> P23 R1 or 2 Newly Reported CMJs)
(File stata_output.doc already exists, option append was assumed)
.
.
. use "c:\mydata\j21.dta", clear
.
. merge 1:m JOBIDX using "c:\mydata\j20.dta", generate(matchvar20)
Result # of obs.
.
. gen SICKPAYX = .
(10,546 missing values generated)
. keep if matchvar20 == 1 | matchvar20 == 3
(3,256 observations deleted)
. replace SICKPAYX = SICKPAY20 if SICKPAY20 != .
(3,200 real changes made)
.
.
. merge 1:m JOBIDX using "c:\mydata\j19.dta", generate(matchvar19)
Result # of obs.
.
. keep if matchvar19 == 3 | matchvar20 == 1 | matchvar20 == 3
(6,586 observations deleted)
. replace SICKPAYX = SICKPAY19 if SICKPAY19 != . & SICKPAY20 == .
(2,334 real changes made)
.
.
. merge 1:m JOBIDX using "c:\mydata\j18.dta", generate(matchvar18)
Result # of obs.
.
. keep if matchvar18 == 3 | matchvar19 == 3 | matchvar20 == 3
(6,018 observations deleted)
. replace SICKPAYX = SICKPAY18 if SICKPAY18 != . & SICKPAY19 == . & SICKPAY20 == .
(1,755 real changes made)
.
.
. save "c:\mydata\j21r753f.dta", replace
(note: file c:\mydata\j21r753f.dta not found)
file c:\mydata\j21r753f.dta saved
.
.
.
. asdoc tabulate SICKPAY SICKPAYX, save(stata_output.doc) font(arial) fs(8) title(Diagnostic Post-Me
> rge - Sickpay * Sickpayx)
(File stata_output.doc already exists, option append was assumed)
.
. log close
name: <unnamed>
log: c:\mydata\APPdofile.log
log type: text