1 / 20

Hidden Biases Using SAS Dates

Hidden Biases Using SAS Dates. Steve James. Information Specialist GASUG Meeting February 1, 2012. National Center for Immunization & Respiratory Diseases. Informatics Office. Hidden Biases Using SAS Dates Summary.

gloria
Download Presentation

Hidden Biases Using SAS Dates

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hidden Biases Using SAS Dates Steve James Information Specialist GASUG MeetingFebruary 1, 2012 National Center for Immunization & Respiratory Diseases Informatics Office

  2. Hidden Biases Using SAS DatesSummary • Just because SAS stores its dates as numbers doesn’t solve all of your problems with dates. • There can be a hidden bias with dates when using units such as months and years. • How you calculate age can introduce a bias.

  3. Hidden Biases Using SAS DatesIntroduction • CDC is developing a system to analyze patient-level Immunization data collected by State Health Departments. • Whether a dose of a vaccine is valid is a critical piece of information for analyzing the data. • A key component of dose validation is the age a patient receives a vaccination.

  4. Hidden Biases Using SAS DatesIntroduction • The Advisory Committee for Immunization Practices (ACIP) determines the guidelines for minimum age of each vaccine. • For example, the minimum age for the Influenza (Flu) vaccine is 6 months. • There is a 4-day grace period associated with all minimum age and minimum intervals.

  5. Initial Design Discussions • How many days are in a year? • “SAS knows how to handle dates.”

  6. SAS Pseudo-Code • Minimum Age for Influenza (Flu) Vaccine is 6 months • IF VaccinationDate – DOB ge 6 months then valid = 1 ; else valid = 0 ;

  7. How Many Days Are In 6 Months? • 180? • 181? • 184? • It depends?

  8. It Depends? • January 1 to July 1 2012 has 182 days. • March 1 to September 1, 2012 has 184. • June 1 to December 1, 2012 has 183. • September 1, 2012 to March 1 2013 has 181.

  9. Hockey and Birthdate Bias • Malcolm Gladwell in his book Outliers describes how some elite Canadian hockey teams have a disproportionate number of players born in the first half of the year. • How children were selected for youth hockey introduced a bias. • Children born soon after the cutoff date had an advantage over those born later in the year.

  10. Personal Example

  11. Problem • There’s not a foolproof way to convert months and years into a certain number of days. • Any attempt to try to force it will cause some doses to be valid when they shouldn’t be and some not to be valid when they should be. • This is a bias that might be easily overlooked in testing.

  12. How Do We Solve This? • MinAgeUnit=‘Months’ ; • MinAgeValue=6 ;If MinAgeUnit = ‘Months’ then do ; if AgeInMonths< MinAgeValue then Valid = ‘No’ ; else Valid = ‘Yes’ ;

  13. Brute Force If MinAgeUnit = ‘Years’ then do ; if AgeInYears < MinAgeValue then Valid = ‘No’ ; else Valid = ‘Yes’ ;If MinAgeUnit = ‘Weeks’ then do ; if AgeInWeeks< MinAgeValue then Valid = ‘No’ ; else Valid = ‘Yes’ ;If MinAgeUnit = ‘Days’ then do ; if AgeInDays< MinAgeValue then Valid = ‘No’ ; else Valid = ‘Yes’ ;

  14. Using Arrays • Array Ages(*) AgeInYearsAgeInMonthsAgeInWeeksAgeInDays;if MinAgeUnit=‘Years’ then index=1;else if MinAgeUnit=‘Months’ then index=2 ;else if MinAgeUnit=‘Weeks’ then index=3 ;else if MinAgeUnit=‘Days then index=4 ;if Ages(index) < MinAgeValue then valid=‘No’ ; else valid=‘Yes’ ;

  15. Calculate Date Minimum Age is Reached • MinAgeDate = INTNX(MinAgeUnit, DOB, MinAgeValue,‘sameday’) - GracePeriod ;If VaccinationDate < MinAgeDate then valid = ‘No’ ; else valid = ‘Yes’ ;

  16. INTNX Function • Returns a SAS date value incremented by a specific number of intervals. • SAMEDAY option available in SAS 9 preserves the alignment of the date within the interval before its incremented.

  17. Calculating Age in Years • Age = INT((SomeDate – DOB) / 365.25 ) ;Off by 1for dates exactly on anniversary. E.G. 01/01/2011 – 01/01/2010 = 365 Int (365/365.25) = 0

  18. Calculating Age in Years • INT (( INTCK(‘month’, DOB,SomeDate) - (DAY(DOB) > DAY(SomeDate))) /12 ) ;This calculates the number of months between two dates and divides that number by 12. • (DAY(DOB) > DAY(SomeDate)) adjusts for those cases when a whole month hasn’t been completed.

  19. Summary • Just because SAS stores its dates as numbers doesn’t solve all of your problems with dates. • There can be a hidden bias with dates when using units such as months and years. • How you calculate age can introduce a bias.

  20. Steve Jamesspj1@cdc.gov404-639-6041 For more information please contact Centers for Disease Control and Prevention 1600 Clifton Road NE, Atlanta, GA 30333 Telephone: 404-639-6041 E-mail: spj1@cdc.gov Web: http://www.cdc.gov The findings and conclusions in this report are those of the authors and do not necessarily represent the official position of the Centers for Disease Control and Prevention. National Center for Immunization & Respiratory Diseases

More Related