BookmarkSubscribeRSS Feed
GeorgeSAS
Lapis Lazuli | Level 10

 Hello everyone,

 

I run a main SAS program in PC, in this program SAS CONNECT will be used to connect UNIX  and run SAS program in UNIX.

after running the UNIX SAS program,the main PC SAS program will run another final program in PC local.this final program will need the output dataset generated from the last UNIX program.

 

My question is how to create a trigger program so the final program in PC will begin to run after the UNIX SAS program is done?

 

Thanks!

9 REPLIES 9
tomrvincent
Rhodochrosite | Level 12

Have the PC SAS job look for the existence of a file every minute or so. 

Have the Unix SAS program create that file when it's finished.

GeorgeSAS
Lapis Lazuli | Level 10

Thank you very much!

 

Read the new file and check its status for every several minutes.

that is a very useful solution but it cost I/O too much also need created some extra file and code. I hope there is a better way to to this.

 

 

Thanks!

Reeza
Super User

Can you do a %INCLUDE at the end of your program?

 

 

 

 

GeorgeSAS
Lapis Lazuli | Level 10
I don't know how to wait and run the include part after SAS connect section finish.
%include method is calling SAS program stored out side the current program. I want to know how to active it after SAS connect section finished.
if I just add an %include after SAS connect. the %include part will be executed immediately after the SAS connect (it doesn't know SAS connect section finished or not)
--so what i need is a trigger that can tell the %include that the SAS connect section is totally finished and %include can start.

Thanks
GeorgeSAS
Lapis Lazuli | Level 10

Thank you Patrick,

 

The waitfor statement should be what I need.but it not works, please help me correct my code in detail:

 

*A program of PC SAS;

libname PC_lib "c:\temp\test123";
data PC_lib.one;
x=1;
run;
*--connect to unix using SAS connect;

%connect(U_server,abc);/*a macro use SAS connect to connect from PC to UNIX*/

rsubmit remote=U_server WAIT=NO; 

libname unix_lib "...";/*unix_lib is a library in UNIX*/

data unix_lib.two; y=2; run;

endrsubmit; signoff remote=userver;

WAITFOR _ALL_ userver;

libname u_map "......."; /*u_map is a mapping drive in PC ,it will point to UNIX drive unix_lib*/
* need u_map.two ready before try to create PC_lib.three;
data PC_lib.three;
set PC_lib.one u_map.two;
run;

 

Thanks!

Reeza
Super User

Look at the WAIT option you're using in your RSUBMIT statement.

http://support.sas.com/documentation/cdl/en/connref/69581/HTML/default/viewer.htm#p1eyablk3vvdlkn1h5...

 

You've specifically set it to run back to back rather than to wait for the connect to finish. If you remove that option, it waits and a %INCLUDE will work. 

 

GeorgeSAS
Lapis Lazuli | Level 10

Thank you Reeza,

 

I am confuse about what you said. would you please modify my code and show me where to make changes? that will greatly help me.

 

Thank you very much!

Reeza
Super User
rsubmit remote=U_server WAIT=YES;

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!

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.

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
  • 9 replies
  • 1763 views
  • 4 likes
  • 4 in conversation