mirror of
https://github.com/sasjs/core.git
synced 2025-12-11 06:24:35 +00:00
feat: mf_dttm macro and associated test
This commit is contained in:
29
base/mf_dttm.sas
Normal file
29
base/mf_dttm.sas
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
@file
|
||||
@brief Returns E8601DT26.6 if compatible else DATETIME19.3
|
||||
@details Per our experience in [Data Controller for SAS]
|
||||
(https://datacontroller.io) 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).
|
||||
|
||||
|
||||
<h4> Related Macros </h4>
|
||||
@li mf_dttm.test.sas
|
||||
|
||||
@author Allan Bowe
|
||||
**/
|
||||
|
||||
%macro mf_dttm(
|
||||
)/*/STORE SOURCE*/;
|
||||
|
||||
%if "&sysver"="9.2" or "&sysver"="9.3"
|
||||
or ("&sysver"="9.4" and "%substr(&SYSVLONG,9,1)" le "3")
|
||||
or "%substr(&sysver,1,1)"="4"
|
||||
or "%substr(&sysver,1,1)"="5"
|
||||
%then %do;DATETIME19.3%end;
|
||||
%else %do;E8601DT26.6%end;
|
||||
|
||||
%mend mf_dttm;
|
||||
|
||||
|
||||
22
tests/crossplatform/mf_dttm.test.sas
Normal file
22
tests/crossplatform/mf_dttm.test.sas
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mf_dttm macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_dttm.sas
|
||||
@li mp_assert.sas
|
||||
@li mp_assertscope.sas
|
||||
|
||||
**/
|
||||
|
||||
%global test1;
|
||||
|
||||
%mp_assertscope(SNAPSHOT)
|
||||
%let test1=%mf_dttm();
|
||||
%mp_assertscope(COMPARE,ignorelist=test1)
|
||||
|
||||
%mp_assert(
|
||||
iftrue=("&test1"="DATETIME19.3" or "&test1"="E8601DT26.6"),
|
||||
desc=Basic test,
|
||||
outds=work.test_results
|
||||
)
|
||||
Reference in New Issue
Block a user