i pull data from a SQL environment into SAS. There is a date field in the table which changes to a 5 digit numeric value. How can I get the date to display as dd/mm/yyyy?
I see when I do a max on the date it gives the issue.
You have to apply a date format to any variables that might be a date, including the one extracted from the database via PROC SQL and any other date variables you create via a function.
I see when I do a max on the date it gives the issue.
The result of a MAX function is the raw value, SQL does not automatically apply the format of the source variable.
See this:
data have;
input dateval yymmdd10.;
format dateval yymmdd10.;
datalines;
2020-05-02
2020-07-13
;
proc sql;
select max(dateval) as dateval
from have
;
select max(dateval) as dateval format=yymmdd10.
from have
;
quit;
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss. Register now and save with the early bird rate—just $795!