DATA Step, Macro, Functions and more

&systime, how to adjust

Accepted Solution Solved
Reply
Super Contributor
Posts: 345
Accepted Solution

&systime, how to adjust

I added &systime  to my footnote so that I can see when it runs. I am confused that the footnote showed the executed time was four hours ahead.

 

Would anybody explain it to me why it is so? For example, it is 9am, how can I adjust this so that it shows the right time that I run the sas code.

 

Thanks.

 


Accepted Solutions
Solution
‎02-24-2016 01:25 PM
Super User
Posts: 19,877

Re: &systime, how to adjust

I don't know what you did so not really. Footnotes/Titles don't stand on their own, you run them with a proc, so showing me a single line of code doesn't mean much.

 

You can try the SAS magic string to reset, usually this means you forgot a run or semi colon. 

Does your header say a certain proc is running? You may just need to reboot the application.

 

;*';*";*/;

For footnotes either of these will work, if you use them correctly.

 

ods html;
proc print data=sashelp.class;
footnote1 "Created on %sysfunc(datetime(), datetime21.) ";
run;



proc print data=sashelp.air(obs=10);
footnote1 "Created on %sysfunc(date(), date9.) %sysfunc(time(), time8.) ";
run;

ods html close;

View solution in original post


All Replies
Super User
Posts: 19,877

Re: &systime, how to adjust

Use TIME()

 

%put %sysfunc(time(), time8.);

 

 

systime contains the time SAS was started, so perhaps yesterday at whatever time is noted?

http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543691.htm

 

 

Super Contributor
Posts: 345

Re: &systime, how to adjust

footnote1 "Created on &sysdate9 %put %sysfunc(time(), time8. )";

 

I need to put time to my footnote. So I added your code to my footnote statement, it does not work

Super User
Posts: 19,877

Re: &systime, how to adjust

Remove the %put

 

Super Contributor
Posts: 345

Re: &systime, how to adjust

"
--------------
49
4238! ;
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
release. Inserting white space between a quoted string and the succeeding
identifier is recommended.

Super User
Posts: 19,877

Re: &systime, how to adjust


wenling wrote:

"
--------------
49
4238! ;
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
release. Inserting white space between a quoted string and the succeeding
identifier is recommended.


 

 

1. It's a note, not an error.

2. It tells you exactly how to fix it.

 

Super Contributor
Posts: 345

Re: &systime, how to adjust

I do not quite understand. I added space to different places, it still does not work

can you explain, or show me the correct space, where I should put

Super User
Posts: 19,877

Re: &systime, how to adjust

You can also use datetime() instead directly. I think sysdate was also system start up date, not necessarily current date if you don't shut down SAS every day.

 

footnote1 "Created on %sysfunc(datetime(), datetime21. )";
Super Contributor
Posts: 345

Re: &systime, how to adjust

it does not work either, after I used the code above

Super User
Posts: 19,877

Re: &systime, how to adjust


wenling wrote:

it does not work either, after I used the code above


What does that mean?

 

Post the exact code you ran and explain what didn't work please.

Super Contributor
Posts: 345

Re: &systime, how to adjust

footnote1 "Created on %sysfunc(datetime(), datetime21.)" ;
49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
release. Inserting white space between a quoted string and the succeeding
identifier is recommended.

 

as a result, sas does not work any more, no result is generated afterwards

can you let me know how to fix it

Solution
‎02-24-2016 01:25 PM
Super User
Posts: 19,877

Re: &systime, how to adjust

I don't know what you did so not really. Footnotes/Titles don't stand on their own, you run them with a proc, so showing me a single line of code doesn't mean much.

 

You can try the SAS magic string to reset, usually this means you forgot a run or semi colon. 

Does your header say a certain proc is running? You may just need to reboot the application.

 

;*';*";*/;

For footnotes either of these will work, if you use them correctly.

 

ods html;
proc print data=sashelp.class;
footnote1 "Created on %sysfunc(datetime(), datetime21.) ";
run;



proc print data=sashelp.air(obs=10);
footnote1 "Created on %sysfunc(date(), date9.) %sysfunc(time(), time8.) ";
run;

ods html close;

Trusted Advisor
Posts: 1,118

Re: &systime, how to adjust

I think, @wenling had submitted the footnote statement (possibly twice) with unmatched quotes. Then, when the corrected statement was submitted, the text Created appeared after what was interpreted as the closing quotation mark. (I could replicate the issue.)

 

In this case the "magic string" should resolve the issue. Even the following short version should do.

";
Super Contributor
Posts: 345

Re: &systime, how to adjust

Posted in reply to FreelanceReinhard

thanks

☑ This topic is solved.

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

Discussion stats
  • 13 replies
  • 347 views
  • 3 likes
  • 3 in conversation