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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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.

View solution in original post

4 REPLIES 4
ballardw
Super User

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.

 

Kurt_Bremser
Super User

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.

sfffdg
Obsidian | Level 7
Thank you sir!!
Reeza
Super User

FCOPY() function

 


@sfffdg 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


 

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
  • 4 replies
  • 4450 views
  • 2 likes
  • 4 in conversation