BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASdevAnneMarie
Barite | Level 11

Hello Experts,

 

I would like to copy the files (SAS EG 8.3) :

	option noxwait;
        x 'cp C:\Users\XX\Desktop\Document\Lettre.pdf,
            C:\Users\XX\Desktop\Documents_2024\Lettre.pdf');

But the file is not copied and I don't have an error message.

Thank you for your help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASdevAnneMarie
Barite | Level 11

Finally I used this function :

 

filename src "\\XXX \&PDF." recfm=n;
		filename dst "\\XXX \&PDF." recfm=n;
		%let rc = %sysfunc(FCOPY(src,dst));
		%put %sysfunc(SYSMSG());

View solution in original post

4 REPLIES 4
andreas_lds
Jade | Level 19

Things to check/do:

- Is sas running local or on a server? If it is running on a server, you can't copy local files.

- Is xcmd enabled?

- Change noxwait to xwait.

- Post the log.

FreelanceReinh
Jade | Level 19

Also, the name of the DOS command is copy, not cp. (And better remove the unbalanced parenthesis at the end. The comma is redundant.)

Kurt_Bremser
Super User

Whenever you need to run an external command, use the PIPE method:

filename xcom pipe "copy C:\Users\XX\Desktop\Document\Lettre.pdf C:\Users\XX\Desktop\Documents_2024\Lettre.pdf 2>&1";

data _null_;
infile xcom;
input;
put _infile_;
run;

This way, all messages returned from the command end up in the SAS log for inspection.

SASdevAnneMarie
Barite | Level 11

Finally I used this function :

 

filename src "\\XXX \&PDF." recfm=n;
		filename dst "\\XXX \&PDF." recfm=n;
		%let rc = %sysfunc(FCOPY(src,dst));
		%put %sysfunc(SYSMSG());

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 4 replies
  • 542 views
  • 5 likes
  • 4 in conversation