Skip to main content
U.S. flag
Health and Human Services Logo

An official website of the Department of Health & Human Services

menu-iconMore mobile-close-icon
mobile-back-btn-icon Back
  • menu-iconMenu
  • mobile-search-icon
AHRQ: Agency for Healthcare Research and Quality
  • Search All AHRQ Sites
  • Careers
  • Contact Us
  • Español
  • FAQs
  • Email Updates
MEPS Home Medical Expenditure Panel Survey
Font Size:
Contact MEPS FAQ Site Map  
S
M
L
XL
 

MEPS HC-203: 2018 Jobs File
Appendix 1: Sample SAS Program

Appendix 2. Sample SAS Program

Convert SAS Datasets to .dat Files

libname jobs17 “c:\mydata\jobs17";
libname jobs18 “c:\mydata\jobs18";

proc export data=jobs17.jobs17 outfile= jobs17.dta;
run;

proc export data=jobs18.jobs18 outfile= jobs18.dta;
run;

Sample Stata Program


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

* 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)
(45,033 missing values generated)

. gen DUPID17 = substr(JOBSIDX_17,1,8)
(45,033 missing values generated)

. destring JOBSN, replace
JOBSN: all characters numeric; replaced as byte
(45033 missing values generated)

. 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
(47,733 observations deleted)

. save “c:\mydata\j18r3.dta", replace
file c:\mydata\j18r3.dta saved

. asdoc list DUPID17 PANEL RN JOBSN 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)
(File Stata_output.doc already exists, option append was assumed)

* 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)
(47,259 observations deleted)

*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
> ) noobs, 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 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
> und 1 and Round 2 Newly Reported CMJs)
(File Stata_output.doc already exists, option append was assumed)

*Prepare FY17 and FY18 data for merge

. sort DUPID17 JOBSN

. save “c:\mydata\j1712.dta", replace
file c:\mydata\j1712.dta saved

* 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
> h using)

Result # of obs.

not matched 0

matched 5,590

. save “c:\mydata\j18r3f.dta", replace
file c:\mydata\j18r3f.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

MEPS HOME . CONTACT MEPS . MEPS FAQ . MEPS SITE MAP . MEPS PRIVACY POLICY . ACCESSIBILITY . VIEWERS & PLAYERS . COPYRIGHT
Back to topGo back to top
Back to Top Go back to top

Connect With Us

Facebook Twitter You Tube LinkedIn

Sign up for Email Updates

To sign up for updates or to access your subscriber preferences, please enter your email address below.

Agency for Healthcare Research and Quality

5600 Fishers Lane
Rockville, MD 20857
Telephone: (301) 427-1364

  • Careers
  • Contact Us
  • Español
  • FAQs
  • Accessibility
  • Disclaimers
  • EEO
  • Electronic Policies
  • FOIA
  • HHS Digital Strategy
  • HHS Nondiscrimination Notice
  • Inspector General
  • Plain Writing Act
  • Privacy Policy
  • Viewers & Players
  • U.S. Department of Health & Human Services
  • The White House
  • USA.gov