Watch this Ask the Expert session to explore how to build and extract date information, plus advanced techniques for generating dynamic, flexible date values.
You will learn:
The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached.
ISO times in SAS follow the ISO 8601 international standard, which provides a consistent, unambiguous numeric representation of time values so data can be shared globally without confusion.
SAS implements this standard through ISO 8601 formats and informats to read, store, and display time and datetime values.
Here’s a link for more information: Reading Dates and Times by Using the ISO 8601 Basic and Extended Notations
SAS formats are strictly for displaying. So, if it's a matter of displaying your date value in different patterns, then you want to use your formats.
But if you are doing calculations, you need to do calculations based on the source date numbers. You can't use the formatted values for calculations. The formatted value is just for display purposes. The actual functions do calculations on the source date numbers.
Apply them on a FORMAT statement.
If I can interpret the question a little more, I think what you might be asking is what if you want both. If you want both in the same report, then you can use an assignment statement in a DATA step to create two versions of your date column.
Your first one is DATE, then maybe create DATE1 equal to DATE, and then you can apply separate formats to each of those columns.
DATA NEWTABLE;
SET INPUTTABLE; /* the source table has a column DATE */
DATE1 = DATE;
FORMAT DATE DATE9. DATE1 MMDDYY10.;
RUN;
SAS explicitly defines INTCK as counting how many interval boundaries are crossed (for example, month boundaries or year boundaries).
This naturally leads to discrete counting because:
Here’s a link with more information: INTCK Function
The way to use dates with the macro facility is to use %SYSFUNC. That's what's going to give you that dynamic feature with your dates.
Using %SYSFUNC with your date values and your date functions gives you that flexibility. It’s the combination of those.
For more information, consider the course: SAS® Macro Language 1: Essentials
SAS does support normalizing international times (GMT/UTC, local zones, etc.), but it does so through a combination of time zone options, ISO 8601 formats, and specific timezone functions, rather than a single “normalize” function.
SAS strongly supports ISO 8601 for international normalization.
For more information: Working with Dates and Times by Using the ISO 8601 Basic and Extended Notations
What you've described is something called a date constant. It's essentially a shortcut for displaying your SAS date or converting a SAS date to a number.
By writing a date in the pattern "01JAN2026"D, you don't have to calculate the number of days manually. SAS automatically converts it for you.
It saves you from having to calculate the number of days yourself.
For example, to calculate how many days an order_date has been outstanding since January 1, 2026:
DAYSPASSED = "01JAN2026"D - ORDER_DATE;
SAS does provide built-in functions specifically for standardizing datetime values to UTC (GMT), including TZONES2U.
For more information: TZONES2U Function
Yes. SAS always stores the original numeric value.
Formats are only for display. Even if you format the value as month and year, the full date and time are still stored behind the scenes.
Yes, dates can be stored as character values. However, you will be limited.
You won't be able to do date calculations. You can apply character functions to extract parts of the value, but you lose access to numeric date functions and interval calculations.
Yes. The ANYDTDTEw. informat can read a wide variety of date and datetime patterns.
For more information: ANYDTDTEw. Informat
If you still cannot find the informat you need, you can create your own using PROC FORMAT with an INVALUE statement.
Recommended Resources
Course: SAS® Programming 1: Essentials
Course: SAS® Macro Language 1: Essentials
SAS Macro Language 2: Advanced Techniques
Please see additional resources in the attached slide deck.
Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars.
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →Ready to level-up your skills? Choose your own adventure.
Your Home for Learning SAS
SAS Academic Software
SAS Learning Report Newsletter
SAS Tech Report Newsletter