@Kurt_Bremser Alleluia. Thank you so much. That is what I wasn't able to get.
Like I said, I know that dates are NOT supposed to be stored in char. It is a specific request from clients on a huge table containing just a few char columns. This table is then sent to another huge program that will transpose etc...therefore I am NOT in position to change the length on any columns etc...Sometimes we need to do strange things.
You do not (as in NOT) store dates in this way in SAS. You simply don't.
SAS dates are counts of days, starting with 1960-01-01 as day zero, stored as numbers, with a date format attached so that the value is human-readable.
If you need to export the dates to another application in a specific format, this is done when the export happens, but while you work with the data in SAS, dates have to be stored as numbers, as described above. Otherwise you deprive yourself of all the nice tools SAS provides out of the box for working with such data.
Since the numeric values of dates are in a quite limited range, you can use a length of 4 for the numeric variables, so you also have a significant saving in terms of space.
> a formula which we could use and would mimic SQL function
What do you use the formula for? Create a new table? The result is a SAS date field? Is the formula is a data step or a SQL query?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.