Desktop productivity for business analysts and programmers

Disconnect server from SAS Enterprise guide programatically

Reply
Occasional Contributor
Posts: 5

Disconnect server from SAS Enterprise guide programatically

I use the below Disconnect button to reset in SAS EG.

How can i do it using SAS code?

Disconnect.PNG

SAS Employee
Posts: 315

Re: Disconnect server from SAS Enterprise guide programatically

Posted in reply to FrancisDsa

Hi @FrancisDsa

 

Why do you need it to be done via code ?

Occasional Contributor
Posts: 5

Re: Disconnect server from SAS Enterprise guide programatically

I am calling a standard macro which sets various libnames, macro variables on a trial folder. I would like it to reset it every time i use.
Example:


%access(trl_id=6545);
SAS Employee
Posts: 315

Re: Disconnect server from SAS Enterprise guide programatically

Posted in reply to FrancisDsa

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 ?

Respected Advisor
Posts: 4,802

Re: Disconnect server from SAS Enterprise guide programatically

Posted in reply to FrancisDsa

@FrancisDsa

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.

Capture.JPG

 

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?

Occasional Contributor
Posts: 5

Re: Disconnect server from SAS Enterprise guide programatically

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);

Respected Advisor
Posts: 4,802

Re: Disconnect server from SAS Enterprise guide programatically

Posted in reply to FrancisDsa

@FrancisDsa

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.

Ask a Question
Discussion stats
  • 6 replies
  • 121 views
  • 0 likes
  • 3 in conversation