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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.