As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

Solutions in the Round -- Does Anyone Really Know What Day It Is? Date Functions and Formats

From sasCommunity
Jump to: navigation, search


From the WUSS abstract for this topic

Who’s counting anyway, right? Wait…SAS is! From January 1st, 1960 onward, to be exact! This session will discuss some of the essentials to know when working with date functions and formats.Solutions in the Round (SITR) is a roundtable format section where attendees discuss approaches and solutions to a programming problem or SAS topic. Users from different perspectives and all experience levels are encouraged to participate.

Discussion at WUSS


  • Joe Perry (JP)


  • Partial Dates
 -  not all data has full digits (missing month and/or day)
 JP:  partial dates (yyyy) interpret as days since 1960. 
 -  add checkpoints on expected ages (18 - 65) for studies?
 -  if length(put(invar,8.)) < 8, then flag as ERROR

  • Proper In/Out format with EXCEL data
 - finding right date format?
 - dates from SQL Server sometimes yields Aug 19, 1960
 - might have to read as char, then convert to numeric (date)

  • Multiple Locales
 - might consider checking range (1..12 vs 1..31) to determine months vs days)

  • Current age at run-time
 -  IT team generates months, /12 for years, /31 for remainder
 JP:  Use intckx()

Further Discussion -- Open to All

Please join the conversation! Also, if you were one of the live participants, please feel free to correct any mistakes or omissions from our original discussion.