Date and time formats in sas

Adarsha Regmi
Nov 24, 2021

--

SAS interpretes the date as the number of days since december1 1960(as IBM launched date.)

some hints

today() -> returns the number of days from 1960 dec 1

times -> number of seconds from midday

datetime -> number of seconds from midday 1960 dec 1;

fixed date = ‘10mar2018’d <here d is called as d literal>
‘3.56't time literal

other important functions

datdif() >returns difference in days

yrdiff() >returns difference in days

intck() -> number of time intervals boundaries

intck(‘year’, mdy(12,31,year), ‘14MAR2019’d,’continuous’)

intnx() -> calculates last date

intnx('month', '14MAR2019'd, 3, 'sameday');

date after 3 months.

format dow. >> represents weekday into text such as 1 as sunday

--

--