I'm pulling data from a database to load into another database. The file spec I've been given says the date I need to provide be in yyyy/mm/dd hh:mm format.
The date field I'm pulling is in SQL Server and it's a datetime field, but from the SAS library side of things it shows as "Number". How can I have it export to my Excel export as a date, and in the yyyy/mm/dd hh:mm format? (e.g. 2019/04/01 00:00)
Hi @kevinharshads1 ,
Since SAS keeps dates/ datetimes as a number of days/seconds since January 1st 1960 I would start with adding proper format to the variable you have and then do the export to Excel, e.g.
proc format;
picture myDate (default=16)
other='%Y/%0m/%0d %0H:%0M' (datatype=datetime);
run;
data want;
set have;
format myVariableName myDate.;
run;
proc export data = want ...
All the best
Bart
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.