BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
X”mv &G_IFC_STG_PATH./map671.sas7bdat &G_IFC_STG_PATH./map671.sas7bdat”;

Is this command valid? Not renaming or moving to another directory...
2 REPLIES 2
japelin
Rhodochrosite | Level 12

First, run "options mprint symbolgen;" to get the command string that resolve the macro variable and check if it executes correctly as a command.

 

Note that the command presented will not be moved or renamed since the first and second parameters are the same file path.

Kurt_Bremser
Super User

Source and target of the move command are identical, so this will in effect do nothing.

 

Anyway, don't use the X statement if you want to know what an external command does, use a PIPE:

data _null_;
infile pipe "mv source target 2>&1";
input;
put _infile_;
run;

The 2>&1 reroutes stderr to stdout, so the data step can read all messages originating from the external comnand and write them to the SAS log.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 503 views
  • 0 likes
  • 3 in conversation