PREPDATETIME Subcommand (ADP command)

The PREPDATETIME subcommand specifies handling of date and time fields.

  • If PREPDATETIME is not specified, by default the procedure computes date and time durations since the current date and time.
  • The original date and time fields will not be recommended as model inputs following automated data preparation.

DATEDURATION Keyword

The DATEDURATION keyword computes the number of years/months/days since a reference date for each variable containing dates.

REFERENCE = CURRENT | YMD('datespec') . Reference date. Specify CURRENT to use the current date as the reference date. Use YMDto specify a custom reference date with the year, month, and day, in that order, in parentheses using a valid date format in quotes. The default is CURRENT.

UNIT=AUTO | YEARS | MONTHS | DAYS. Date units for computed durations. Specify the units for the computed durations. AUTOdetermines the units based on the following rules. The default is AUTO.

  • If the minimum number of elapsed days is less than 31, then the duration is returned in days.
  • If the minimum number of elapsed days is less than 366 but greater than or equal to 31, then the duration is returned in months. The number of months between two dates is calculated based on average number of days in a month (30.4375): months = days/ 30.4375.
  • If the minimum number of elapsed days greater than or equal to 366, then the duration is returned in years. The number of years between two dates is calculated based on average number of days in a year (365.25): years = days / 365.25.

Explicitly specifying YEARS, MONTHS, or DAYS returns the duration in years, months, or days, respectively. Optionally, in parentheses, specify SUFFIX= with a suffix in quotes. The default suffix depends upon the unit; YEARS, MONTHS, and DAYS have defaults _years, _months, and _days, respectively.

TIMEDURATION Keyword

The TIMEDURATION keyword computes the number of hours/minutes/seconds since a reference time for each variable containing times.

REFERENCE = CURRENT | HMS('timespec'). Reference date. Specify CURRENT to use the current time as the reference time or use HMSand the hour, minute, and second, in that order, in parentheses using a valid time format in quotes. The default is CURRENT.

UNIT = AUTO | HOURS | MINUTES | SECONDS. Date units for computed durations. Specify the units for the computed durations. AUTOdetermines the units based on the following rules. The default is AUTO.

  • If the minimum number of elapsed seconds is less than 60, then the duration is returned in seconds.
  • If the minimum number of elapsed seconds is larger than or equal to 60 but less than 3600, then the duration is returned in minutes.
  • If the minimum number of elapsed seconds is larger than or equal to 3600, then the duration is returned in hours.

Explicitly specifying HOURS, MINUTES, or SECONDS returns the duration in hours, minutes, or seconds, respectively. Optionally, in parentheses, specify SUFFIX= with a suffix in quotes. The default suffix depends upon the unit; HOURS, MINUTES, and SECONDS have defaults _hours, _minutes, and _seconds, respectively.

EXTRACTYEAR Keyword

The EXTRACTYEAR keyword extracts the year element from a date variable.

Optionally specify the SUFFIX keyword in parentheses with a suffix in quotes. The default suffix is _year.

EXTRACTMONTH Keyword

The EXTRACTMONTH keyword extracts the month element from a date variable.

Optionally specify the SUFFIX keyword in parentheses with a suffix in quotes. The default suffix is _month.

EXTRACTDAY Keyword

The EXTRACTDAY keyword extracts the day element from a date variable.

Optionally specify the SUFFIX keyword in parentheses with a suffix in quotes. The default suffix is _day.

EXTRACTHOUR Keyword

The EXTRACTHOUR keyword extracts the hour element from a time variable.

Optionally specify the SUFFIX keyword in parentheses with a suffix in quotes. The default suffix is _hour.

EXTRACTMINUTE Keyword

The EXTRACTMINUTEkeyword extracts the minute element from a time variable.

Optionally specify the SUFFIX keyword in parentheses with a suffix in quotes. The default suffix is _minute.

EXTRACTSECOND Keyword

The EXTRACTSECOND keyword extracts the second element from a time variable.

Optionally specify the SUFFIX keyword in parentheses with a suffix in quotes. The default suffix is _second.