Transforming SAS Dates – From here to there, funny things are everywhere

Every now and again I get to right some SAS code.

And every know and again I need to transform SAS dates, from Date/Time to Date9 or from Date to Date/Time etc.

Its one thing that I always end up looking at SAS support for the correct syntax.  So Im going to post each one I use here so I can find them easily.

SAS Date to Date/Time

To convert a SAS date to a SAS Date/Time, by adding a time of 00:00:00 to it use:

dhms(<date_variable_name>,0,0,0)

  • Share/Bookmark
Leave a comment

1 Comments.

  1. myDateTime = date_variable_name * 86400;

    Nice and easy but done out of habit.

    Alan

Leave a Reply


[ Ctrl + Enter ]