Can DM.RFPENDTC have a partial dates? If yes, how do we take max of a partial dates?
If this is a SAS table and the variable is numerical with a SAS Date or DateTime format attached (=how SAS stores dates) then no, because such dates are counts of days since 1/1/1960 or datetime values are counts of seconds since 1/1/1960 and such counts can't be "partial".
If the variable is of type character then yes, the string could be partial and you would need to convert it to a SAS date or datetime value before you can derive the max - and if and how SAS can convert partial date strings to a SAS date value is documented (look at informats for dates and datetimes).
Are you talking about CDISC datasets?
I think the C in the DTC suffix stands for CHARACTER.
To find the maximum or character strings in YYYY-MM-DD order you can just take the MAX() since strings in that pattern when sorted lexigraphically will also be sorted chronologically. Note that will treat partial dates as being before any actual date in that month (or year) since spaces are less than digits.
If you want to use some other algorithm then you will need to convert the partial dates into actual dates. For example it is common to pick the middle of the interval. So the 15th if the day of the month is missing. June if the month is missing. This could yield a different maximum than sorting the partial date strings lexigraphically.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.