BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ren2010
Obsidian | Level 7
Hi,

I came across this article on "How to print the current date and time in the SAS Output window instead of the date and time that the SAS session was started" on Support.sas.com,also there is a sample code:

options nodate;
data _null_;
call symput ('timenow',put (time(),time.));
call symput ('datenow',put (date(),date9.));
run;

title "The current time is &timenow and the date is &datenow";

I am using sas 9.1.3,but when i tried to run this ,i dont see any values displayed,and do not see any error messages in the log.I appreciate if anyone has any idea why this is happening.

Thanks,
Ren
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:
Are you following your TITLE statement with a procedure or some process that -uses- a TITLE statement??? Normally, the title statement by itself just changes the title in the SAS "holding area" for titles. You wouldn't see the results of the TITLE statement unless you did this:

 

options nodate;
data _null_;
call symput ('timenow',put (time(),time.));
call symput ('datenow',put (date(),date9.));
run;

title "The current time is &timenow and the date is &datenow";
ods listing;
proc print data=sashelp.class;
run;



cynthia

 

Also from @Doc_Duke:

Be aware that the title is somewhat misleading. That method prints the date and time the DATA _NULL_; step was run, not the "current" date and time (It was current then but may not be current when printed.). That doesn't matter much for short jobs, but can be an important difference in definition for ones that run for hours or days. Look at http://support.sas.com/kb/8/682.html for an option that gets "closer" to current.

View solution in original post

5 REPLIES 5
Cynthia_sas
SAS Super FREQ

Hi:
Are you following your TITLE statement with a procedure or some process that -uses- a TITLE statement??? Normally, the title statement by itself just changes the title in the SAS "holding area" for titles. You wouldn't see the results of the TITLE statement unless you did this:

 

options nodate;
data _null_;
call symput ('timenow',put (time(),time.));
call symput ('datenow',put (date(),date9.));
run;

title "The current time is &timenow and the date is &datenow";
ods listing;
proc print data=sashelp.class;
run;



cynthia

 

Also from @Doc_Duke:

Be aware that the title is somewhat misleading. That method prints the date and time the DATA _NULL_; step was run, not the "current" date and time (It was current then but may not be current when printed.). That doesn't matter much for short jobs, but can be an important difference in definition for ones that run for hours or days. Look at http://support.sas.com/kb/8/682.html for an option that gets "closer" to current.

sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
It's not until your next PROC or DATA step execution will reflect the current TITLE declared.

Scott Barry
SBBWorks, Inc.
Doc_Duke
Rhodochrosite | Level 12
Be aware that the title is somewhat misleading. That method prints the date and time the DATA _NULL_; step was run, not the "current" date and time (It was current then but may not be current when printed.). That doesn't matter much for short jobs, but can be an important difference in definition for ones that run for hours or days. Look at http://support.sas.com/kb/8/682.html for an option that gets "closer" to current.

Doc Muhlbaier
Duke

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 31903 views
  • 4 likes
  • 4 in conversation