Get comfortable programming with Medicare data and SAS


We all know the importance of understanding the data you are working with. After all, the best programmers we know have combined their lifelong pursuit of programming knowledge with a similar pursuit of some specific subject matter.

I have programmed in SAS for about 15 years and have pursued expertise in health care use, cost, and quality measurement for more than 10 of those years. I wrote my new book, SAS Programming with Medicare Administrative Data, to provide information I wish existed when I started SAS programming for Medicare and to offer the new generation of SAS programmers guidance on using Medicare data.

My hope is that this book will help readers accomplish three main goals:

Gain substantive knowledge of the Medicare program. Just knowing how to program using SAS isn’t enough. Users need to understand the Medicare program before they can successfully and accurately use Medicare data in their studies.

For example, unlike most commercial health plans, Medicare generally covers elderly beneficiaries. Therefore, the Medicare population is usually sicker than the populations enrolled in commercial plans. Also, some services do not appear in Medicare claims data, like services paid for by Medicare managed care plans (Medicare Advantage) and prescription drugs administered during a hospital stay.

Why does this matter? Let’s say you are measuring the quality of care provided for a beneficiary with diabetes who is enrolled in Medicare Advantage; without all of the claims for this beneficiary, you might analyze provider performance incorrectly by stating a test (like an HbA1c test) was not performed, when in fact it was. My book provides a primer on the Medicare program and the foundations of subject matter expertise, setting you on the right track for accurate research and analysis.

Build experience by using real-world applications that can be applied to new work. Each chapter features exercises that challenge the reader to apply knowledge of the Medicare program to real-world programming tasks. By the time readers complete the book, they will be able to develop original programs that analyze and yield statistics on enrollment, costs, service use, and quality of care.

What’s more, the examples in the book can be modified for a variety of research tasks. For example, the reader can alter beneficiary enrollment requirements when selecting a population for analysis or swap out diabetes for congestive heart failure when studying chronic conditions. In other words, readers can perform their own original research using Medicare data based on the groundwork provided in the book.

Improve their skills regardless of programming level. The book is written for programmers at all levels. Beginners can use it as a template to program a project from beginning to end, whereas more advanced users can use it to create SAS algorithms that employ methodologies for answering common research questions. SAS users are encouraged to use SAS Programming with Medicare Administrative Data as a reference guide, leveraging the included examples to address more complex real-world programming tasks.

The Medicare research field will continue to change rapidly. My hope is that SAS Programming with Medicare Administrative Data will prepare the new generation of SAS programmers to continue to provide high quality, informative research in this dynamic environment.

Matthew Gillingham is the director of health research systems at Mathematica Policy Research.


About Author

Matthew Gillingham

Director of health research systems at Mathematica Policy Research and SAS Press author

Matthew Gillingham is the director of health research systems at Mathematica Policy Research. His career in health care data analytics began with analyzing commercial claims and enrollment data. For more than ten years, he has used SAS to build software that analyzes administrative health care and Medicare administrative data. He is the author of SAS Programming with Medicare Administrative Data.



    You could either use the DATA step approach (PROC SORT first, then do a DATA step SET statement with the same by-variables used in the sort) or PROC SQL code to roll-up the data at the stay-level (i.e., claim) or at the beneficiary-level (i.e., bene_id). There's are several SAS SUGI & SGF published papers w/ lots of examples. One could use the TRANSPOSE procedure to accomplish this task. Good luck!

  2. Hi Mr. Gillingham! I purchased your text book titled "SAS Programming with Medicare Administrative Data". Thank you so much for sharing all that info. Could you please help me out on how to convert claim level inpatient file to stay level records. I would like to keep the file long, but identify single stays rather than multiple claims for one stay (collapse these multiple claims into single stay record with admission date from first claim and discharge date from last claim). Sorry, If this sounds repetitive.


Back to Top