BookmarkSubscribeRSS Feed
am2019
Calcite | Level 5

I need to copy 7 sas files from unix to windows.  To save time, I want to submit the copy statement for each of these at the same time.  I'm using the rsubmit and endrsubmit process in a macro loop.  This way there are 7 copy statements running at the same time.  However, I can't figure out how to make the sas job wait for all the submitted copy statements to finish before continuing.  Do I use a waitfor _all_ statement, and where do I put it?  

 

%MACRO toWin;     

 

  %DO i = 1 %TO 7;

        %SYSLPUT file=file.&i. / remote=sessw&i.;

        %SYSLPUT mSysDir =unix directory /REMOTE=server-ID>; 

       %SYSLPUT mStgDirW = windows directory /REMOTE=server-ID>;

           

   rsubmit sessw&i. connectwait=no connectpersist=no sysrputsync=yes;

        copy file&i. from unix to windows

   endrsubmit ;

%end ;

 

%mend;

%toWin;

 

2 REPLIES 2
Tom
Super User Tom
Super User

If you just want to copy files between locations available on the same machine just use SYSTASK, no need for any RSUBMIT.

 

But how are you planning to copy files from Windows to Unix?

 

Are you use RSIGNON to start a remote SAS session in the other environment?  In that case use PROC UPLOAD or PROC DOWNLOAD to move the files from one to the other.

 

Do you have the same disks shared between the two environments? In that case you are just doing local copies.

 

SASKiwi
PROC Star

If you want to use parallel DOWNLOADs then you need to start a new SAS session for each one using the SIGNON statement. Then you run a separate RSUBMIT WAIT=NO group for each session followed by a WAITFOR for each session, finishing off with SIGNOFF for each session. As @Tom has said PROC DOWNLOAD is what you use to copy the files.

 

Also SAS and SAS/CONNECT need to be installed on both your Unix and Windows computers. 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1134 views
  • 0 likes
  • 3 in conversation