08-02-2017 10:31 AM
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.
08-02-2017 10:50 AM
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.
x "su - newuser";
libname ss 'xxxxxxxxxx';
08-02-2017 11:55 AM
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;
08-02-2017 12:30 PM - edited 08-02-2017 12:32 PM
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 ?
08-02-2017 12:35 PM - edited 08-02-2017 12:37 PM
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.
08-03-2017 04:25 AM - edited 08-03-2017 04:29 AM
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.
08-03-2017 05:37 AM
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.
08-03-2017 08:15 AM
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.
08-04-2017 10:59 PM
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.
08-03-2017 08:54 AM