MEPS HC-211: 2019 Jobs File

Appendix 1: Sample SAS Program

Appendix 2. Sample Stata Program


Convert SAS Datasets to .dat Files

libname jobs18 "c:\mydata\jobs18";
libname jobs19 "c:\mydata\jobs19";
proc export data=jobs18.jobs18 outfile= jobs18.dta;
run;
proc export data=jobs19.jobs19 outfile= jobs19.dta;
run;

Sample Stata Program

name: <unnamed>
log: c:\mydata\APPdofile.log
log type: text
.

. * Select continuing Panel 23, Round 3 Current Main JOBS
. *(SUBTYPE=1, STILLAT=1) from the FY 2019 JOBS file
.

use "c:\mydata\jobs19.dta", clear
format PANEL SUBTYPE STILLAT SICKPAY %3.0f
keep if PANEL==23 & RN==3 & SUBTYPE==1 & STILLAT==1 & SICKPAY==-1
(44,859 observations deleted)

save " c:\mydata\j19r3.dta", replace
(note: file c:\mydata\j19r3.dta not found)
file c:\mydata\j19r3.dta saved

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 Continuation Round 3 Records)

. * Select newly reported Panel 23 Current Main JOBS records from
. * the FY 2018 JOBS file and print selected variables
. * Rename JOBSIDX and DUPERSID for merge with 2019 data
.

use " c:\mydata\jobs18.dta", clear
. format PANEL SUBTYPE STILLAT SICKPAY %3.0f
. keep if PANEL==23 & SUBTYPE==1 & STILLAT==-1 & inrange(RN,1,2)
(45,549 observations deleted)

. *Print Sample of Newly Reported Round 1 and Round 2 Records
.

asdoc list JOBIDX PANEL RN SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(0) noob
> s, save(stata_output.doc) title(Print Sample of Newly Reported Round 1 and Round 2 Records)
(File stata_output.doc already exists, option append was assumed)

. *Sickpay Value of FY2018 Round 1 and Round 2 Newly Reported CMJs
.

asdoc tabulate SICKPAY, font(arial) fs(8), save(stata_output.doc) title(Sickpay Value of FY2018 Ro
> und 1 and Round 2 Newly Reported CMJs)
(File stata_output.doc already exists, option append was assumed)

. *Prepare FY18 and FY19 data for merge
.

sort JOBIDX
.
. save " c:\mydata\j1812.dta", replace
(note: file c:\mydata\j1812.dta not found)
file c:\mydata\j1812.dta saved

. * Create a dataset (J19R3F) that includes all variables
. * for the continuation Round 3 Current Main JOBS and create
. * the new variable SICKPAYX by copying SICKPAY from the
. * corresponding Round 1 or Round 2 newly reported job record
.

rename SICKPAY SICKPAYX
.
. keep JOBIDX SICKPAYX
.
. merge m:m JOBIDX using "c:\mydata\j19r3.dta", n
> ogenerate keep(match using)
Result # of obs.

not matched 2
from master 0
from using 2
matched 5,473

save "c:\mydata\j19r3f.dta", replace
(note: file c:\mydata\j19r3f.dta not found)
file c:\mydata\j19r3f.dta saved

. * Diagnostic Post-Merge - Sickpay * Sickpayx
. * "\Round 3 Continuation Current Main Jobs Only
.

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


Return To Top