unix mv command in sas

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

unix mv command in sas

Hi 

 

I want to move a file from one directory to another directory in sas using x command.

below is my command:

 

x "mv &rawfile. &archivefile.";

 

but the file is not moving..

 

is anything wrong in the code?

 

Thanks,

Swathi


Accepted Solutions
Solution
‎01-11-2018 06:52 PM
Super User
Posts: 8,590

Re: unix mv command in sas

Posted in reply to swathiprasad

To check if the command works, do this:

filename oscmd pipe "mv &rawfile. &archivefile 2>&1";

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

This will put all messages from the command into the log. If nothing is read, the command worked.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Posts: 12,148

Re: unix mv command in sas

Posted in reply to swathiprasad

Do your macro variables contain fully qualified paths? If not the source file is likely being searched for subordinate to the location of where the SAS is currently executing and not finding the file.

 

Also some environments your admin may have the system XCMD option disabled. You may be able to test this with:

proc options option=xcmd;run;

If the log shows NOXCMD that would be one thing to address.

 

Solution
‎01-11-2018 06:52 PM
Super User
Posts: 8,590

Re: unix mv command in sas

Posted in reply to swathiprasad

To check if the command works, do this:

filename oscmd pipe "mv &rawfile. &archivefile 2>&1";

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

This will put all messages from the command into the log. If nothing is read, the command worked.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Occasional Contributor
Posts: 15

Re: unix mv command in sas

Posted in reply to KurtBremser
Thank you sir!!
Super User
Posts: 21,530

Re: unix mv command in sas

Posted in reply to swathiprasad

FCOPY() function

 


swathiprasad wrote:

Hi 

 

I want to move a file from one directory to another directory in sas using x command.

below is my command:

 

x "mv &rawfile. &archivefile.";

 

but the file is not moving..

 

is anything wrong in the code?

 

Thanks,

Swathi


 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 137 views
  • 1 like
  • 4 in conversation