BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
slolay
Fluorite | Level 6

Hi

I would like to produce a macro variable containing the start date and time a program was run. This will be used to add to the final report produced by the program

I am currently using:

/* create report start datetime macro variable */

data _null_;

       call symput('repstdttm',put(datetime(),datetime14.));

       put "SAS program started: &repstdttm. ";

run;

this gives me

     16DEC11:09:30  but I would like to get:

     Friday 16DEC2011:09:30

Is this possible using a format?

I know there is the &sysday automatic variable but this is when the SAS session was started I believe. The way above should give me the time the datastep was executed

Thanks in advance

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

You could always just roll your own.  e.g.:

/* create report start datetime macro variable */

data _null_;

  want=catx(" ",put(today(),downame.),put(datetime(),datetime.));

  call symput('repstdttm',want);

run;

%put SAS program started: &repstdttm.;

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

You could always just roll your own.  e.g.:

/* create report start datetime macro variable */

data _null_;

  want=catx(" ",put(today(),downame.),put(datetime(),datetime.));

  call symput('repstdttm',want);

run;

%put SAS program started: &repstdttm.;

FriedEgg
SAS Employee

proc format;

picture dowdt other='%A %0d%b%Y:%0H:%0M (datatype=datetime);

quit;

%let repstddttm=%sysfunc(datetime(),dowdt.);

slolay
Fluorite | Level 6

Thanks Guys!!!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 853 views
  • 3 likes
  • 3 in conversation