
152 Handbook of SAS
®
DATA Step Programming
function, or the datetime value by using the DHMS function. The syntax of
these functions is listed in Table9.3. Program 9.3 illustrates the use of these
functions.
Program 9.3:
title 'Constructing date and time values';
data ex9_3;
current_date = today();
current_time = time();
current_datetime = datetime();
date1 = mdy(8,31,2012);
date2 = yyq(2012,3);
time = hms(6,12,30);
datetime = dhms(current_date, 6,12,30);
file print;
put 'current_date: ' current_date date9.;
put 'current_time: ' current_time time.;
put 'current_datetime: ' current_datetime datetime.;
put 'date1: ' date1 date9.; ...