Font Size:
|
||||||
MEPS HC-203: 2018 Jobs File Appendix 2. Sample SAS ProgramConvert SAS Datasets to .dat Fileslibname jobs17 “c:\mydata\jobs17"; proc export data=jobs17.jobs17 outfile= jobs17.dta; proc export data=jobs18.jobs18 outfile= jobs18.dta; Sample Stata Programname: <unnamed>
* Select continuing Panel 22, Round 3 Current Main JOBS
*(SUBTYPE=1, STILLAT=1) from the FY 2018 JOBS file * Since identifier structures differ in 2018 from prior years * Create JOBSN and 2017 formatted DUPERSID called DUPID17 . use “c:\mydata\jobs18.dta", clear . gen JOBSN = substr(JOBSIDX_17,11,1) . gen DUPID17 = substr(JOBSIDX_17,1,8) . destring JOBSN, replace . format DUPID17 %12s . format JOBSN %3.0f . format PANEL SUBTYPE STILLAT SICKPAY %3.0f . keep if PANEL==22 & RN==3 & SUBTYPE==1 & STILLAT==1 & SICKPAY==-1 . save “c:\mydata\j18r3.dta", replace . asdoc list DUPID17 PANEL RN JOBSN SUBTYPE STILLAT
SICKPAY if _n<=20, font(arial) fs(8) separator(0 * Select newly reported Panel 22 Current Main JOBS
records from
* the FY 2017 JOBS file and print selected variables * Rename JOBSIDX and DUPERSID for merge with 2018 data . use “c:\mydata\jobs17.dta", clear . rename JOBSIDX JOBSIDX_17 . rename DUPERSID DUPID17 . format JOBSN %3.0f . format PANEL SUBTYPE STILLAT SICKPAY %3.0f . keep if PANEL==22 & SUBTYPE==1 & STILLAT==-1 & inrange(RN,1,2) *Print Sample of Newly Reported Round 1 and Round 2 Records
. asdoc list DUPID17 PANEL RN JOBSN SUBTYPE STILLAT SICKPAY if _n<=20, font(arial) fs(8) separator(0 *Sickpay Value of FY2017 Round 1 and Round 2 Newly Reported CMJs
. asdoc tabulate SICKPAY, font(arial) fs(8), save(Stata_output.doc) title(Sickpay Value of FY2017 Ro *Prepare FY17 and FY18 data for merge
. sort DUPID17 JOBSN . save “c:\mydata\j1712.dta", replace * Create a dataset (J18R3F) 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 DUPID17 JOBSN SICKPAYX . merge m:m DUPID17 JOBSN using “c:\mydata\j18r3.dta", nogenerate keep(matc Result # of obs. not matched 0 matched 5,590 . save “c:\mydata\j18r3f.dta", replace * 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 . log close |
||||||