Master SAS in 30 days!

A jargon-free, easy-to-learn SAS base course that is tailor-made for students with no prior knowledge of SAS.

YEAR, MONTH and DAY Functions

The YEAR, MONTH and DAY functions retrieve the year, month and day from a date variable, respectively.

Example

The data set above a list of dates. You can retrieve the year, month and day from the date column using the YEAR, MONTH and DAY functions.

data ds2;
set ds;
yr = year(date);
mt = month(date);
dy = day(date);

run;

The year, month and day are retrieved from the list of dates:
 

Become a Certified SAS Specialist

Get access to two SAS base certification prep courses and 150+ practice exercises

Master SAS in 30 Days

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
iconmail

Get latest articles from SASCrunch

SAS Base Certification Exam Prep Course

Two Certificate Prep Courses and 300+ Practice Exercises