Hi,
I want to create macro for processing date with time something like
%let processdt = %sysfunc(today(), datetimeformat);
%put &processdt;
the output should be 2019-08-01 00:00:00.0
proc format;
picture dtStamp (round)
low - high = '%Y-%0m-%0d %0H:%0M:%0S.%s' (datatype=datetime);
run;
%put NOTE: %sysfunc(datetime(), dtStamp.);
Here's the roll your own format options, dtStamp is the format name.
@meckarthik wrote:
Hi,
I want to create macro for processing date with time something like
%let processdt = %sysfunc(today(), datetimeformat);
%put &processdt;
the output should be 2019-08-01 00:00:00.0
data _null_;
dt=dhms(today(),0,0,0);;
put dt= datetime18.;
run;
Take note of Maxim 28. In most cases, such macro variables need no format.
@meckarthik wrote:
Hi,
I want to create macro for processing date with time something like
%let processdt = %sysfunc(today(), datetimeformat);
%put &processdt;
the output should be 2019-08-01 00:00:00.0
9 %put NOTE: %sysfunc(datetime(),E8601LX20);
NOTE: 2019-08-01T08:53:14
19 %put NOTE: %sysfunc(datetime(),E8601LX22.1);
NOTE: 2019-08-01T08:56:22.2
Pretty close I think you need the T.
data _null_;
processdt =datetime()-time();
/* write your call symputx here and store in global symbol table*/
put processdt=;
format processdt e8601dt25.;
run;
proc format;
picture dtStamp (round)
low - high = '%Y-%0m-%0d %0H:%0M:%0S.%s' (datatype=datetime);
run;
%put NOTE: %sysfunc(datetime(), dtStamp.);
Here's the roll your own format options, dtStamp is the format name.
@meckarthik wrote:
Hi,
I want to create macro for processing date with time something like
%let processdt = %sysfunc(today(), datetimeformat);
%put &processdt;
the output should be 2019-08-01 00:00:00.0
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.