I use the below Disconnect button to reset in SAS EG.
How can i do it using SAS code?
So it seems like we're dealing with two different things here:
1.) Starting and stopping a SAS Workspace Server
2.) Setting some variables within the session once it running
Is this correct ?
The ABORT statement would allow you to terminate a SAS Session programmatically within a SAS data step;
There is also the global statement ENDSAS; which you just could issue at the end of your program.
Both these statement are quite "brutal" and you'd normally only use them if something goes wrong and you really want to kill the session.
As I understand it what you want to do is just to re-assign/recreate "stuff" whenever you call a specific macro.
Ideally the macro code/logic does this for you. IF the macro hasn't build in logic to only issue commands if they haven't been issues already earlier in another call (=checks for macro variables and librefs already existing) then I'd assume if you just call the macro with another parameter things work already as you need it.
Sooo... What's the issue/the problem you need to solve?
Its a Standard macro controlled by a group which i cant change.
It looks for a read only global macro variable.
%if %symexist(__dm_initial_sasautos__) %then %do;
%put MESS: ***** Macro &sysmacroname already run. Previous values are used;
%goto final_end;
%end;
The only way is to reset is to Disconnect SAS EG.
However i would like to use Standard macro and instead of asking enduser to Disconnect everytime you run, I would like to handle it programmatically
%SYMDEL __dm_initial_sasautos__;(will not work)
%access(trl_id=6545);
Then I guess you've got only two options.
A) Talk to the people maintaining this macro and ask if they could provide an additional parameter to allow for the macro to re-execute on request.
B) Copy the macro code and change the logic to what you need it to be, then issue the macro code at the beginning of your program. That should compile it into WORK which comes quite early in the macro search path (SASAUTOS) so you should pick-up your macro version when calling it.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.