Skip to content

About

Code to process the CMS Provider of Services hospital data

Resources

Stars

10 stars

Watchers

2 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

CMS Provider of Services Hospital Data 1993-2025

In this repository you'll find code to process the CMS Provider of Services hospital data. This data provides a host of basic information about hospitals like location, size, teaching status, and type of control (e.g. non-profit, for-profit, government). All hospitals from 1993-2025 are included. We pull source data from CMS for 2011 onwards; earlier years come from NBER's yearly extracts of the same file.

For more information on the data and extracts, see pages from CMS and NBER.

The code produces three datasets, each saved as both an R .Rdata file and a Stata .dta file. The main dataset, pos, has a record for each hospital in each year it appeared in the source data. The remaining two datasets have one record per hospital: pos_firstyear has only the record for the first year it appeared while pos_lastyear has the record for the last year it appeared.

Notes on the Data

  • With this update, labeled variables in Stata are no longer stored as the same numeric codes they had in the source POS data. Make sure to read the value label! In R, these variables are stored as factors.
  • Hospitals that close will typically stay in the data in future years. The post-closure records should have a termination code (termcode) and termination date (termdate).
  • Hospitals that merge, change subtype, or change type of control will usually get a new provider number. In this case, their old provider number will persist in the data but will get a termination code and date going forward. Keep this in mind when attempting to follow hospitals longitudinally. If you are lucky, the new hospital records will indicate the previous provider number (prev_pn).
  • The data appears to be updated pretty infrequently, so the hospital characteristics in it may be quite out of date.
  • The variables that count residents (residents) and beds (beds_tot and beds_cert) are very occasionally NA in 2011 and 2012. This issue seems to almost exclusively affect transplant hospitals.
  • The variables that indicate the provider subtype e.g. short-term/long-term/etc. (provider_subtype) and type of control e.g. non-profit/for-profit/government (typ_control) are sometimes NA. This issue seems to be limited to certain transplant hospitals, federal hospitals like VA facilities, and Canadian hospitals. Note that indicators I derived from these variables (shortterm, cah, nonprofit, forprofit, govt) will be set to FALSE in this case.

Download the processed data

I have put the processed Provider of Services data online at the below link:
(Includes data in R and Stata format)

http://sacarny.com/public-files/provider-of-services/latest/provider-of-services.zip

Instructions for processing the data yourself

The repository includes the source data in it. It comes from the CMS website starting in 2011 and the NBER website for earlier years. The NBER source data is stored in source-nber/ (download_source.sh is the historical script to download these files, but NBER now blocks automated scripts from downloading). The CMS source data is stored in source-cms/ and is downloaded by download_source_cms.R.

  1. Clone the repository (you may need to install Git LFS): git clone https://github.com/asacarny/provider-of-services.git
  2. Install the tidyverse, haven, lubridate, and labelled packages, if necessary.
  3. (Optional) To extend the data to new years, edit end_year in download_source_cms.R and re-run it. Then edit pos.R and change end_year as well.
  4. In R, set the working directory to the repository and run pos.R (for example, from a terminal at the repository root: Rscript pos.R).

Change Log

July 30, 2026

  • Rewrite in R
  • Check source data directly into the repository
  • New script to pull data directly from CMS

November 30, 2019

  • Initial commit

About

Code to process the CMS Provider of Services hospital data

Resources

Stars

10 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages