BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
PopCorn14
Obsidian | Level 7

@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.  

Kurt_Bremser
Super User

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.

 

ChrisNZ
Tourmaline | Level 20

> 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: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 17 replies
  • 1719 views
  • 5 likes
  • 6 in conversation