PING  0.9
Statistical data handling and processing in production environment
ds_datetime
  • Convert date and time (datetime) character variables from dataset or from macro variables in one integer variable.
%let dt_integer=%ds_datetime_integer(vardate=,vartime=, _dt_integer_=);
  • retrieve time (currentdate variable) and date (lastup variable) from a dsn or from macro variable. Cnvert them in one integer variable.
%let dt_integer=%ds_datetime_integer(dsn=, _dt_integer_=, currentdate=currentdate, lastup=lastup,lib=WORK);

Arguments

  • dsn : a dataset reference;
  • vardate : (option) variable dataset name for time;
  • vartime : (option) variable dataset name for date.
  • currentdate : (option) variable time;
  • lastup : (option) variable date.

Returns

  • _dt_integer_ : integer value , i.e.: YYYYMMDDHHMMSS

Examples

Two semple examples of use, namely: Using variables:

%let vartime=12:52:24;
%let vardate=09FEB17;
%ds_datetime_integer(vardate=&vardate,vartime=&vartime, _dt_integer_=);

returns: dt_integer=20170209125224.

Using test dataset #41:

%let dsn=_dstest41;
%ds_datetime_integer(dsn=&dsn,_dt_integer_=, currentdate=currentdate, lastup=lastup,lib=);

returns: dt_integer=YYYMMDDHHMMSS

Run macro %_example_ds_datetime_integer for more examples.

Notes

Accepted formats for: vartime is HH:MM:SS vardate is DDMMMYY

Examples:

%let vartime=12:52:24;
%let vardate=09FEB17;

See also