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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.