WEEKDAY Function

From a SAS date value, returns an integer that corresponds to the day of the week.

Category:Date and Time

Syntax

WEEKDAY(date)

Required Argument

date

specifies a SAS expression that represents a SAS date value.

Details

The WEEKDAY function produces an integer that represents the day of the week, where 1=Sunday, 2=Monday, ..., 7=Saturday.

Example

data one;
input date date7.;
datalines;
25dec21;
data new;
set one;
   y=weekday(date);
   put y=;
run;

These statements produce this result:

y=7
Last updated: April 14, 2026