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;