BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
mtgkooks
Fluorite | Level 6

In AS400 systems, the IBM date format can be transmitted in the format CYYMMDD, where the C indicates Century and is either a "0" to indicate a date earlier than 2000 or a "1" for dates thereafter. For example: 960412 = 4/12/1996, 1180809 = 8/9/2018.

 

To convert this date format to a SAS date, you can use the following line in your PROC SQL statements:

mdy(mod(<datefield>,10000)/100,mod((<datefield>,100),(<datefield>/10000) + 1900)

You can also add a "format=" statement to return the value you're looking for, eg:

format = date9.

would return 09AUG2018,

format = mmddyys10.

would return 08/09/2018.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Visit a random SAS tip This SAS Tips board is not open for replies or comments, but we welcome your feedback and questions. Have a question or comment about this tip? Start a new topic in one of our discussion boards, and reference this tip topic.
Discussion stats
  • 0 replies
  • 5003 views
  • 3 likes
  • 1 in conversation