Macros for SAS Application Developers
https://github.com/sasjs/core
mf_fmtdttm.sas File Reference

Returns E8601DT26.6 if compatible else DATETIME19.3. More...

Go to the source code of this file.

Detailed Description

From our experience in Data Controller for SAS deployments, the E8601DT26.6 datetime format has the widest support when it comes to pass-through SQL queries.

However, it is not supported in WPS or early versions of SAS 9 (M3 and below) when used as a datetime literal, eg:

data _null_;
  demo="%sysfunc(datetime(),E8601DT26.6)"dt;
  demo=;
run;

This macro will therefore return DATEITME19.3 as an alternative format based on the runtime environment so that it can be used in such cases, eg:

data _null_;
  demo="%sysfunc(datetime(),%mf_fmtdttm())"dt;
  demo=;
run;

Related Macros

Author
Allan Bowe

Definition in file mf_fmtdttm.sas.