DATA Step, Macro, Functions and more

need some trigger program

Reply
Regular Contributor
Posts: 241

need some trigger program

 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!

Contributor
Posts: 33

Re: need some trigger program

Posted in reply to GeorgeSAS

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.

Regular Contributor
Posts: 241

Re: need some trigger program

Posted in reply to tomrvincent

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!

Super User
Posts: 19,861

Re: need some trigger program

Posted in reply to GeorgeSAS

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

 

 

 

 

Regular Contributor
Posts: 241

Re: need some trigger program

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
Respected Advisor
Posts: 4,173
Regular Contributor
Posts: 241

Re: need some trigger program

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!

Super User
Posts: 19,861

Re: need some trigger program

Posted in reply to GeorgeSAS

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. 

 

Regular Contributor
Posts: 241

Re: need some trigger program

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!

Super User
Posts: 19,861

Re: need some trigger program

Posted in reply to GeorgeSAS
rsubmit remote=U_server WAIT=YES;
Ask a Question
Discussion stats
  • 9 replies
  • 171 views
  • 4 likes
  • 4 in conversation