SAS author’s tip: Getting an accurate picture of claims data

This week’s author tip is from Matthew Gillingham and his new book SAS Programming with Medicare Administrative Data. Gillingham has been programming in SAS for 15 years and has spent 10 of those years specifically dealing with health care use, cost and quality measurement.

Here’s Gillingham’s tip for you:

To gain a complete picture of each Medicare beneficiary’s medical history, use claims data for beneficiaries continuously enrolled in Medicare for your study period.

Identifying beneficiaries who have been continuously enrolled in Medicare FFS (be it for a calendar year or a period prior to or following a specific medical event, like a hospitalization) is a common task in research programming with Medicare administrative data. Because Medicare administrative claims data include all FFS claims submitted on behalf of a beneficiary, and most likely will not include claims for managed care enrollees, focusing on beneficiaries who are enrolled in Medicare FFS helps to ensure that we have a complete picture of each beneficiary’s medical history for the period being studied.

SAS Programming with Medicare Administrative Data shows you how to determine the impact of a demonstration program on payment, utilization, and quality. In order to do so comprehensively, you must limit the population you’re studying to those beneficiaries who have been continuously enrolled in Medicare FFS for the period of time being studied (in the case of my book, for all twelve months of the calendar year) to help ensure that you have an accurate picture of their claims data during that time. To accomplish this task, use the following code.

data enr.contenr_2010;
    set src.mbsf_ab_2010;
	length contenrl_ab_2010 contenrl_hmo_2010 $5.;
    if bene_hi_cvrage_tot_mons=12 and bene_smi_cvrage_tot_mons=12 then contenrl_ab_2010='ab'; else contenrl_ab_2010='noab'; 
    if bene_hmo_cvrage_tot_mons=12 then contenrl_hmo_2010='hmo'; else contenrl_hmo_2010='nohmo'; 
	if death_dt ne . then death_2010=1; else death_2010=0;

In Step 6.2, we output the following frequency distribution of the enrollment flags we created in Step 6.1, the results of which are illustrated by Output 6.1:

ods html file="C:\Users\mgillingham\Desktop\SAS Book\FINAL_DATA\ODS_OUTPUT\Gillingham_fig6_2_ENRL.html" 
image_dpi=300 style=GrayscalePrinter;
ods graphics on / imagefmt=png;
proc freq data=enr.contenr_2010; 
    tables contenrl_ab_2010 contenrl_hmo_2010 death_2010 / missing; 
ods html close;

Output 6.1: Continuous Enrollment Variables

Gillingham_1Finally, in Step 6.3 we create our file of continuously enrolled beneficiaries by delimiting the ENR.CONTENR_2010 file created in Step 6.1 by the enrollment flags we defined in that same step. A beneficiary is defined as continuously enrolled in Medicare Parts A and B in calendar year 2010 if the value of CONTENRL_AB_2010 is equal to ‘AB,’ the value of CONTENRL_HMO_2010 is equal to ‘NOHMO,’ and the value of DEATH_2010 is not equal to 1. We keep only these records.

data enr.contenr_2010_fnl;
    set enr.contenr_2010;
	if contenrl_ab_2010='ab' and contenrl_hmo_2010='nohmo' and death_2010 ne 1;

If this piqued your interest, get a copy of the book to learn more on defining continuous enrollment, or more on research programming using Medicare data.

The excerpt is from SAS Press author Matthew Gillingham’s book “SAS Programming with Medicare Administrative Data” Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software).

Post a Comment

You, too, can have a book at SAS Global Forum 2015

DSC_7083_smallYou’re walking around the bookstore at SAS Global Forum, looking at the new books and upcoming titles. There are lots of titles that look helpful, and a couple that are on your must-have list. You see SAS users and students eagerly talking with the authors, treating them like rock stars. And you think to yourself, ”wonder what it takes to be a SAS author?”

Well, wonder no more! Our web site gives you an overview of how to become a SAS author. And we’re always here to answer your questions and help you get started.

We’re signing up authors now. And if you submit a book proposal by early August (yes, that’s next month), we will review that proposal, get feedback to you as quickly as possible, and, if your proposal is accepted, get your project started. Then your book can be promoted at SAS Global Forum 2015.

If you’re ready to show the world that you’re a SAS expert, let’s get started. All it takes is an idea, a dedication to writing and a positive attitude. Together, we’ll get you ready to be the next rock star of SAS Global Forum!

Contact us today to get started.

**If next month feels a little soon to you, tune in next week to learn what you need to do to have your book ready by JSM 2015.**

Post a Comment

SAS author’s tip: Performing floating point number comparisons

The SAS author’s tip of the week blogs are back! Sorry for the short break - I’ve been working to transition into my new role as editor of the SAS Bookshelf.

We will continue to feature these helpful tips for our readers. Please let me know if there is any other content you would like to see us cover.

Now back to this week’s author tip from Jack Shostak’s new book SAS Programming in the Pharmaceutical Industry, Second Edition.

The following excerpt is from SAS Press author Jack Shostak’s book, “SAS Programming in the Pharmaceutical Industry, Second Edition”. Copyright © 2014, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (Please note that results may vary depending on your version of SAS software.)

Performing Floating-Point Comparisons

At times, you need to perform some form of floating-point number comparison. The following example illustrates such a comparison where you are setting laboratory value flags to indicate whether a lab test is above or below normal.

Program 4.15  Using the ROUND Function with Floating-Point Comparisons

data ADLB;
   set lb;
      if . < lbstresn < 3.15 then
         ANRIND = "L";
      else if lbstresn > 5.5 then
         ANRIND = "H";

At first glance the SAS code snippet above looks fine. If the lab value is less than 3.15, then the lab value is low, and if it is greater than 5.5 then the lab value is high. The problem is that floating-point numbers are stored on computers as approximations of the value that you may see in a SAS printout. In other words, 3.15 might be stored as 3.1500000000000000000000000000000000012, which might make the program snippet above not work as hoped. To handle the floating-point comparison problem, this example can be written more safely like this:

data ADLB;
   set lb;
      if . < round(lbstresn,.000000001) < 3.15 then
        ANRIND = "L";
      else if round(lbstresn,.000000001) > 5.5 then
	 ANRIND = "H";

Notice how the “lbstresn” variable has been rounded to an arbitrary precision to the ninth decimal place. This attempts to get around the floating-point comparison problem. At the same time, it avoids rounding the “lbstresn” variable to a precision where meaningful data are lost. Whenever you perform comparisons on numbers that are not integers, you should consider using the ROUND function.

You should read the excellent SAS Technical Support Note “TS-230: Dealing with Numeric Representation Error in SAS Applications” to learn more about SAS floating-point numbers and numeric storage precision in SAS. Another good resource for rounding issues is Ron Cody’s SAS Functions by Example, Second Edition (SAS Press, 2010). Remember that floating-point storage of non-integer numbers in SAS is done by machine-based approximation, and that can cause problems in comparisons, sorts, and any other operations on those numbers.

Was this helpful? If you're interested -- Get your copy today to receive all of Jack Shostak’s tips from SAS Programming in the Pharmaceutical Industry. (You’ll also find more free, bonus content!).  You'll find a free book excerpt, example code and data, and more.

Post a Comment

Bend it like our BI Dashboard experts

Go USA! Go Germany! Go Mexico! Go Colombia! Wish you were still in it, England! That’s right, it’s World Cup time, and due to the international flavor of my family, I’ve got a number of teams I’m rooting for.

I played a little soccer (or “futbol” in our house) back in the day. I can’t say I was an expert (mediocre would be generous, really), but as I watch the games, I’m amazed at how easy the professionals make it look. Pure talent aside, imagine having a window into their knowledge of the game and the techniques they use.

You may not be able to learn from the professionals on the soccer field, but you can learn from some of the best SAS experts out there—SAS consultants.

With the new (free!) e-book, SAS Consulting® Services on SAS® BI Dashboard: Interaction Examples for Dashboard Designers, dashboard designers who have a good understanding of SAS BI Dashboard can learn how to improve their dashboards with more complex, customized features. In it, Global SAS Consultant Teri Patsilaras presents three examples that show how to build complex dashboards:

Part 1: A brush interaction example

Part 2: A client-side filter interaction example

Part 3: A server-side filter interaction example

Each of these examples blends together multiple features that ultimately produce powerful dashboards for your users.

Score a goal with an assist from SAS consultants: Get your free copy today.

Post a Comment

So what’s the big data?

There’s a lot of excitement right now around the book, Big Data, Data Mining, and Machine Learning: Value Creation for Business Leaders and Practitioners by Jared Dean, SAS Senior Director of Research and Development.

At SAS, Dean is responsible for the development of the company’s worldwide data mining solutions. His book explains how organizations can harness the power of high-performance computing architectures as well as data mining, text analytics and machine learning algorithms.

I caught up with Dean at the Analytics 2014 conference in Frankfurt, Germany to ask him why he wrote this book.

You can also read an excerpt (PDF) from the book.

Post a Comment

Three reasons to learn SAS macro facility

People tend to think of the SAS macro facility as something to tackle when you’ve reached ‘advanced programmer’ status. But macro programming can be easy to learn, and it allows you to work faster and more effectively.

Here are three reasons why you should consider learning the macro facility, even if, or perhaps especially if, you’re a beginning SAS programmer:

  1. When you use the macro facility, you can accomplish repetitive tasks quickly and efficiently. A macro program can be reused many times. Parameters passed to a macro program customize the results without having to change the code within the macro program.
  2. Macro programming can provide a more modular structure to your SAS programs. SAS language that is repetitive can be generated by macro language statements in a macro program and that macro program can be referenced in your SAS program. The main program becomes easier to read – especially if you give the macro program a meaningful name for the task it performs.
  3. A more detailed reason is that it makes it much easier to pass information between steps. For example, a PROC SQL step can summarize data and save results in macro variables. These macro variables can then be used by subsequent DATA steps and PROC steps in the same SAS session to customize the processing.

And a bonus reason – most SAS programming job descriptions ask for applicants with macro programming experience. My latest book SAS Macro Programming Made Easy, Third Edition will start you down the path to obtaining that required experience.

Post a Comment

Catch that lazy day read and make learning a breeze with two JMP books


It’s summertime, and that means it’s time to grab a good book and relax in the hammock out back. And, if you’re like me, having a good read that can give me a leg up at work is a bonus – and these two books are perfect hammock reading.  While they cover a broad range of ways to use JMP® to analyze data, the simple step-by-step instructions in each make learning a breeze.


Fundamentals of Predictive Analytics with JMP -- Great for the novice user, yet useful for you advanced statistical analysts, this book covers the intermediate steps between basic statistics and predictive analytics and leads you to data mining. Learn how to apply the basic methods of predictive analytics, including linear regression, analysis of variance, classification and regression trees, logistic regression and neural networks. Check it out for step-by-step instructions on how to perform and evaluate an analysis in JMP complete with screenshots like the ones shown here.



Also valuable for the beginner and advanced researchers, JMP for Basic Univariate and Multivariate Statistics covers a broad range of analyses.


You’ll find descriptions and statistical details on studies from simple descriptive statistics through t-tests to regression and analysis of variance, making complex multivariate procedures easy to do. This second edition was updated from version 5 to version 10 and includes major improvements to many existing platforms with simple and clear terms followed by research examples.


So, shake off that hammock, grab a book and kick back for some intellectually stimulating reading. Don’t forget your sunscreen and bug spray!

What are you reading this summer? Share your favorite book in the comments section.

Post a Comment

Write a SAS book

As SAS software continues to develop, the demand for information grows.

That’s why there’s a big recruitment effort underway at SAS Books to get experts to share their best practices on using SAS.

Recruiter Shelley Sessoms attended the Analytics 2014 conference in Frankfurt, Germany last week to find new writers.

I caught up with her at the conference to find out what she’s looking for and how potential authors can get started.


Here’s the link that Shelley mentioned where you can learn more and submit your proposal.

Post a Comment

The Most Unusual Place You’ve Had SAS

So, what is the most unusual place that you have had SAS?

Okay, I admit it; I used a somewhat provocative title and lead sentence to get you to read this blog.  It must have worked because here you are.  But, do not worry; there are no hidden meanings, untoward innuendos, or inappropriate double-entendres from here onward.  Instead, I am going to rephrase the central question with the hope that you will be inspired to answer it by taking the time to post a comment to this blog.

What I am really asking is for an answer to any of the following:

  • What is the most unusual location you have written a SAS program from?
  • What is the most unusual circumstance under which you have written a SAS program?
  • What is the most unusual computing platform that you wrote a SAS program from?
  • What is the most unusual SAS application program that you wrote?

Given the breadth and scope of the SAS experience readers of the SAS Bookshelf blogs have, I would bet that we will get a very interesting mix of answers to these questions.  Perhaps you wrote SAS programs on a laptop on the beach while on vacation.  Maybe you wrote a must-have-now SAS program at great personal risk during a ferocious lightning storm.  Perhaps you ran SAS programs in batch on a VAX computer back in the day.  Or, maybe you wrote a SAS program that computed the total number of jelly beans that could be stored in a 1-pint container.  Whatever the case, you are bound to have an interesting anecdote.

Being the author of this blog, I will go first.  I’ve written SAS programs in various office settings, at the beach, on airplanes, in hotels, and in a vacation rental at a dude ranch.  But, none of those were the most unusual for me.

The most unusual location that I wrote a SAS program from was sitting at a desk in the screened-in porch of a rental house.  At first read, that doesn’t sound too unusual.  But, the fact is that the previous week a violent thunderstorm with winds of up to 85-miles per hour swept through the Washington DC suburbs shattering an otherwise tranquil Friday night.  At about 9:45 pm, a 100-plus-foot oak tree fell completely across my back yard, through the roof from the plate glass window at the back of my living room, across the living room, across the foyer and projected forty feet into the front yard.  It cut my house in half and missed me by eight feet.  So, sitting in a rental house a mile-and-a-half away from what was left of my home, writing a SAS program was, to say the least, unusual.

I realize that is a bit of an outlier circumstance, but it is the best I can come up with.  How about you?

So, what is the most unusual place that you have had SAS?

Be sure to take a look at Michael Raithel's latest book How to Become a Top SAS Programmer.

Post a Comment

Stay curious! Benefit yourself and your organization

Recently one of our most popular authors, Michael Raithel, a Senior Systems Analyst for Westat, presented a SAS Talks and was interviewed for an AllAnalytics radio show.  Michael is the author of more than 25 SAS technical papers, four SAS Press books, and a popular lecturer at SAS Global Forum and regional conferences.

In his SAS Talks Webinar, Michael discusses PROC DATASETS and the versatility of this SAS PROC.  In his opinion and many other programmers would tend to agree, if you have to choose just one SAS PROC, this is the one for you.  As Michael says “it’s the veritable Swiss army knife of SAS procedures.”  Listen in to hear this outstanding author tell you why.

On the popular AllAnalytics radio show, Michael was interviewed about his newest book, “How to Become A Top SAS Programmer.” He tells that his inspiration for writing it was from years of speaking at so many SAS events, writing lots of technical papers, as well as books plus content for many SAS listservs.  Michael was finding the same issues/questions were coming up time and time again.  Many programmers were wanting advice on what he would recommend if they were new to SAS programming or programming in general, how to advance their career, how they can be the person that other SAS programmers turn to in addition to being more valuable to their organization and the list goes on and on.

With a quest for knowledge and drive to solve the business needs, you have unlimited prospects for professional growth and success ahead of you. Delve more into learning about why SAS PROC DATASETS is the PROC for you as well as how to distinguish yourself as that top SAS programmer you were meant to be when you listen in on both of these terrific events.

As Michael puts it…”Stay curious, my friend.  That is the best advice I can give to benefit your career and your organization!”

Post a Comment