BookmarkSubscribeRSS Feed
FrancisDsa
Calcite | Level 5

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

How can i do it using SAS code?

Disconnect.PNG

6 REPLIES 6
nhvdwalt
Barite | Level 11

Hi @FrancisDsa

 

Why do you need it to be done via code ?

FrancisDsa
Calcite | Level 5
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);
nhvdwalt
Barite | Level 11

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 ?

Patrick
Opal | Level 21

@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?

FrancisDsa
Calcite | Level 5

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

Patrick
Opal | Level 21

@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.

sas-innovate-2024.png

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.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2412 views
  • 0 likes
  • 3 in conversation