@makset wrote:
from this:
%let m8=Aug;
%let dtcut = %sysevalf("18&m8.2022:23:59:59"dt);
%put &=dtcut;
Yes, the code I provided works.
not this:
%let dtcut = %sysevalf("2022-08-18-23-59-59"dt);
%put &=dtcut;
ERROR: Unknown %SYSEVALF conversion operand 'DTCUSTOM.' specified; conversion is terminated. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: putn("2022-08-18-23-59-59"
No one ever said this would work. It doesn't work because "2022-08-18-23-59-59"dt is not recognized anywhere in SAS as valid code. Only date/time literals like this will work: "18aug2022:23:59:59"dt, the appearance must be that exactly, except the the letters can be mixed case or upper case. Your date time value is not that appearance, so SAS will not recognize it and can't use it.
However, this works:
%let dtcut = %sysfunc(inputn(2022-08-18-23-59-59,anydtdtm.));
%put &=dtcut;
... View more