DATA Step, Macro, Functions and more

Override system date

Occasional Contributor
Posts: 18

Override system date



is it possible to override system date in SAS Program. I have a batch job that I need to re-run. 


I need to ensure that system date is read as 1st April 2017 and not actual today's date. 

Super User
Super User
Posts: 9,813

Re: Override system date

Well, technically it possible to get your IT to change the system clock.  I would however find that to be a major breach of the infrastructure.  The current date time is there for a reason, if you want to put a specific date in a document or something then put that in, but don't refer to it as "system date" then.  

Super User
Posts: 13,913

Re: Override system date

Is your program using any variable to hold the date of interest? It may be that you need to modify the program as "one time" job to have the date literal for the day of interest in place of whatever may be looking at system dates or date functions such as today().


Or show the code that uses a date value to see what suggestions may be available.

Super User
Posts: 10,534

Re: Override system date



The IT people will have your hide hanging over their door, as a reminder for others. And do so for a reason. Actually not one reason, but many.


If you need to re-run a batch job, it should correctly record today's date as the date of the rerun. Job specific date values (eg the month for which an accounting job runs) should NEVER be taken from the system date, but be supplied to the job from the scheduler.

Our end-of-month batch jobs run over the course of several days, but all have the same "execution date". Rerunning them correctly is as easy as editing a script file and running that. And the logs will fatefully capture that a certain job was rerun for a certain execution date on a later day; this way we hold everything accountable, as mandated by law(!).

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 4 in conversation