Can anyone please tell me what i am doing wrong here
format date datetime18.;
the date in the output is 1/1/1960 5:33:18 AM
You are trying to write a date (number of days) using a datetime format. So it is interpreting the number of days as the number of seconds.
View solution in original post
In order to get it in datetime format, try something like this
format date date9. new_date datetime18.;
thank you both
so i actually used new_date=dhms(date,00,00,00) and then applied the format datetime.
You could also just write a datetime literal instead of a date literal.
I know but the thing is this date variable is actually a macro var from another SAS code which resolves to 02oct2014 so I had to use the "&date"d in the dhms function
Using Tom's method you could specify "&date.:00:00:00"dt to resolve your SAS date as a datetime.
Need further help from the community? Please
ask a new question.