1
votes

Below is my code of 5 lines. When I run the first 3 lines I get a date output of 21042 and would like it displayed/formatted as 8/11/2017. I am having trouble with the format part (line 4) and need help with it. My code is:

PROC SQL;
select max (Load_DT) as max_date
from in.db_tb    
Format max_date yymmdd10.;
quit;
1

1 Answers

2
votes

You need to put the format statement in the select part of the query.

data db_tb;
  load_dt = today();
run;


PROC SQL;
select max (Load_DT) as max_date format yymmdd10.
from db_tb    ;
quit;

Note your stated preference (8/11/2017) does not match the format you use in your code (2017-08-11). MMDDYY10. is the format that you'd want for that.