PING  0.9
Statistical data handling and processing in production environment
datetime_current

Returns a formatted timestamp string from the current datetime.

%let dt=datetime_current(stamp=, sep=_);

Arguments

stamp : (option) flag setting the returned time stamp to second (s), minute (mn), hour (h), day (d), month (mth) or year (y) only; default: not considered; sep : (option) parameter defining the separator between day and time (see below); default: sep=_ (simple underscore).

Returns

dt : the current datetime formatted in the following way: <day><sep><time>.

Example

Display the current datetime:

%put Current datetime is: %datetime_current();

or the current year:

%put Current year is: %datetime_current(stamp=year);

Run macro %_example_datetime_current.

References

  1. SAS date, time, and datetime functions.
  2. About SAS date, time, and datetime values.
  3. SAS date, time, and datetime functions.
  4. Carpenter, A.L. (2005): "Looking for a Date? A tutorial on using SAS dates and times".
  5. Milum, J. (2008): "How to read, write, and manipulate SAS dates".
  6. Morgan, D. (2015): "The essentials of SAS dates and times".

See also