BookmarkSubscribeRSS Feed
Hari2
Quartz | Level 8

Hi,

 

I have around 20 SAS programs to run one after the other and I will run them from PC SAS remotely using RSUBMIT AND ENDRSUBMIT. After running 5 steps, I need to switch the user and then run step 6(Isince I can't run step 6 using my user access). please suggest how to switch the user in UNIX server from PC SAS so that I will run the step 6 and then come back to same user to run rest of the steps from step7.

 

Thanks,

Hari.

10 REPLIES 10
Reeza
Super User

Do you have X command permissions? Can you pass commands to your OS?

Hari2
Quartz | Level 8

Hi,

 

I think I have . I ran this code just to confirm whether the code I am running is getting created from newuser or my user. But, the dataset ss.mm1 is getting created from my user.

 

rsubmit;

x "su - newuser";

libname ss 'xxxxxxxxxx';

data ss.mm1;

set ss.mm(obs=1);

run;

endrsubmit;

Tom
Super User Tom
Super User

From your description you are running one program on your PC that is using RSUBMIT to run some steps on a remote computer.

So if you want some of the steps run using userid one and others using userid two then just make two connections to the remote computer. Something like this.

 

signon remote1;
rsubmit remote1;
* program 1;
endrsubmit;
rsubmit remote1;
* program 2;
endrsubmit;

...
signoff remote1;
signon remote2;
rsubmit remote2;
* program 6;
endrsubmit;
Hari2
Quartz | Level 8

Hi Tom,

 

Thanks.

 

This seems, it will work out in my scenario. But one thing, I will use a SAS script to connect to UNIX server and I will provide my userid and password and I will be able to connect. but, at step 6, where I need to swith the user that's super user and I wont have PW (I can only switch to that user as I have access). now, if I run sas script in between to login with new user, I wont have PW. So how to overcome this.

do we get any sas script to login as password less login or should I make any settings to my ID to not to ask PW for that super user ?

Tom
Super User Tom
Super User

So it sounds like you need to (1) connect to server as you (2) run some command to switch to the captive account (3) launch SAS.

 

In the old days we used to use signon scripts that told SAS how to make the connection.  So you could just edit the script and add code for step (2) between the signon process and the launch SAS command.

 

Or you could create a command that combines (2) and (3) and then call that command to launch SAS instead of the default command you normally use to launch SAS.

Hari2
Quartz | Level 8

Hi Tom,

 

    1. Even I run Signon script from PC SAS to login to sasgrid1(Unix  SAS Server) and I will provide my Username & PW.

    2. After running 5 steps, I need to swith the user in the smae SAS Server to run next step.

 

    So here, is there a way to Swith user from the same SAS session instead of Sifnoff from my user and again run Signon script to login with super user ? Becasue after step 6, again I have to run next 3 steps from my user and then from step 10 again I have to swith to super user, for 11-20 again I have to run from my user. So, switching back and forth is a bit difficult as I am automationg the process and we dont want to wait at system and give credentials when ever it asks to Switch the user.

 

Please provide your comments.

ChrisBrooks
Ammonite | Level 13

Your PC session can be connected to more than one remote session at the same time although when issuing your signon, signoff and rsubmit you have to name the sessions. You also have to coordinate their timings with the waitfor statement. Example 4 at this link shows you how it's done.

 

So at the start of your run you log on twice - once as your normal user and once as your super user. Your program should rsubmit to your normal user session until you hit the part where you want to run as the super user. You then rsubmit that to your super user session. I've run multiple sessions at the same time using this technique a lot - it's easy once you get the hang of it.

Hari2
Quartz | Level 8

Hi Chris,

 

Thanks very much. I will work on your suggetion.

 

If possible, can you send the piece of code to signon to server from PC sas. I will just refer it and make updates as required.

Patrick
Opal | Level 21

@Hari2

I had years ago a use case where I couldn't directly connect to server B but I could connect to server A and then from server A connect to server B. This was possible by nesting rsubmit blocks - the outer rsubmit connected to server A and then within this rsubmit was another nested rsubmit block which connected to server B.

I guess you could use the exactly same approach for your use case.

 

I don't remember anymore if we had to mask the inner rsubmit block so that it only got executed on the server A or if this works without any masking. But I know that this is an approach which will work.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2188 views
  • 0 likes
  • 5 in conversation