05-02-2016 09:24 PM - edited 05-02-2016 09:28 PM
This is with regard to the task i would like to do with sas toolbox from the command line. I would like to reset the existing sas session without closing it. so that it clears log , output and the sas session is again ready to execute the program. Even if there are any errors from the previous execution, when reset is done the sas session should be able to run the next program with no impact from the previous run.
I believe it could be done with the DM commands. However i am unable to get a good material to write the series of command that i could write to accomplish this task. And i want to execute those commands in the sas toolbox command line or if we could create a tool also i am with it.
could you please provide any link or suggestion on how to achieve i would appreciate it.
p.s.: working on sas 9.3 unix sas
05-03-2016 04:21 AM - edited 05-03-2016 11:57 AM
What you want to do is much more easily achieved by starting a new SAS session than trying to manually reset all setings that SAS possibly keeps.
Keep in mind that a spot on the surface of the earth that is 40.007 km away from you is right behind you in the opposite direction.
Take the short route.
05-04-2016 01:51 AM
Thank you KurtBremser. I agree with you. However i would like to familiarize with DM commands and see how best they could be used. Also i believe if we could reset the sas session without closing then i thought it will save time. This will help me to run another program in the same session even if the previous executed program generated errors.
So if you could give me any information on this it will be very helpful.
Appreciate your response.
05-05-2016 01:44 AM
You would have to do it manually
Off the top of my head:
Reset system options to their original value
Reset macro variables to their original value
Remove macros compiled after startup
Remove macro variables that were added
Clear additionally defined libnames
Clear additionally defined libraries
Reset library definitions that were modified
Clear the WORK library
Clear format definitions
I do not think that this list is complete.
Now think of the complexity of a program that handles all this, and how long it will take to run, and how error-prone it will be.
Compare this with the fact that, on a healthy system, SAS will take less than a second to stop/start.
05-05-2016 06:16 AM - edited 05-05-2016 06:22 AM
I've seen proprietary SAS macros to perform a fairly complete list of clean-up tasks (see Kurt Bremser's list). These were definitely more complex than a few DM commands. A typical use case would be programs called by a "master program" with a series of %INCLUDE statements.
Edit: If it's just to save time in an interactive SAS session, starting a new session is probably the quickest, easiest and safest solution.