BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
michelconn
Quartz | Level 8

I am attempting to copy files over to a different folder and am using the sysexec fuction. The issue that I am running into is my file paths is UNC so SAS keeps opening the CMD window and I have to manually exit for each file. Since there are 3500 files to transfer this isn't really a good option. Any suggestions to get SAS to exit for me? I could transfer the files over to my C: drive but I would put that as the last option. 

 

%let source=\\global\kcshares\Projects\110933\Police Reports\All Reports;
%let target=\\global\kcshares\Projects\110933\Police Reports\Curve Reports;

proc sql noprint;
	select report
	into :report separated by ' '
	from crashes;
quit;
%put &report;
%macro report;
%do i=1 %to 5; *%sysfunc(countw(&report," "));
	%let report_no=%scan(&report,&i," ");
		%sysexec copy "&source.\&report_no..pdf" "&target.\&report_no..pdf"; 
%end;
%mend;
%report;

Untitled.png

1 ACCEPTED SOLUTION

Accepted Solutions
michelconn
Quartz | Level 8

I found the solution I needed to use:

 

options NOXWAIT;

View solution in original post

2 REPLIES 2
michelconn
Quartz | Level 8

I found the solution I needed to use:

 

options NOXWAIT;

ballardw
Super User

If you were copying all of the files with common name you can use wildcards such as

 

copy "&source.\rep*.pdf" would copy all files that start with the letters 'rep'. Or if you needed all of the PDF files then *.pdf

 

So you may not have needed to copy them one by one.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1473 views
  • 1 like
  • 2 in conversation