DATA Step, Macro, Functions and more

Full date from datetime value eg, Friday, 16DEC2011:09:30

Accepted Solution Solved
Reply
Contributor
Posts: 51
Accepted Solution

Full date from datetime value eg, Friday, 16DEC2011:09:30

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


Accepted Solutions
Solution
‎12-16-2011 01:37 PM
PROC Star
Posts: 7,363

Full date from datetime value eg, Friday, 16DEC2011:09:30

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


All Replies
Solution
‎12-16-2011 01:37 PM
PROC Star
Posts: 7,363

Full date from datetime value eg, Friday, 16DEC2011:09:30

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.;

Trusted Advisor
Posts: 1,300

Re: Full date from datetime value eg, Friday, 16DEC2011:09:30

proc format;

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

quit;

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

Contributor
Posts: 51

Full date from datetime value eg, Friday, 16DEC2011:09:30

Thanks Guys!!!!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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