Manipulating SAS Date Values with Functions

SAS Date Functions

SAS stores date, time, and datetime values as numeric values. You can use several functions to create these values. For more information about datetime values, see SAS Date, Time, and Datetime Values.
Table 14.4 Typical Use of SAS Date Functions
Function
Example Code
Result
MDY
date=mdy(mon,day,yr);
SAS date
TODAYDATE
now=today();
now=date();
today's date as a SAS date
TIME
curtime=time();
current time as a SAS time
Use other functions to extract months, quarters, days, and years from SAS date values.
Table 14.5 Selected Functions to Use with SAS Date Values
Function
Example Code
Result
DAY
day=day(date);
day of month (1-31) ...

Get SAS Certified Specialist Prep Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.