I have a volatile table built wilh a set of values
ID XDATE
123 02APR2020
234 06FEB2020
234 03MAR2020
.....
I am querying the Max date grouped by the ID
PROC SQL;
select ID, MAX(XDATE) as XDATE from TABLE1
group by ID;
run;
I get the result as
ID XDATE
123 22007
234 22046
345 21970
How do i get a date output like '12-31-2999'
PROC SQL;
select ID, MAX(XDATE) as XDATE format=mmddyy10. from TABLE1
group by ID;
run;
PROC SQL;
select ID, MAX(XDATE) as XDATE format=mmddyy10. from TABLE1
group by ID;
run;
Thank you Thank you!
MAX(XDATE) as XDATE format mmddyyd10.
In SQL when you use a function with AS NEWVARIABLE then the result will use the default numeric format, which is BEST because you did not tell SAS you wanted a different one.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.