I assume that you got as far as to allocate an XML library and write to that. So what you have is a source path, which is the path of your XML library. And a destination path, which is the archive folder. And a member name, the name of the dataset that you wrote in the source path library. You now have 3 options. 1: to allocate the destination path with an XML libname as well, and use proc copy to copy it to the archive library; libname dest xml '<destination folder>';
proc copy in=<source lib> out=dest;
select <dataset name>;
run; proc delete data=<source lib>.<dataset name>; run; This is probably the slowest, as SAS may do some processing of variables etc. along the way. As shown here, it also lacks a check for a successful copy, so that the source table only gets deleted if the copy goes well. 2: to copy the generated XML file as a flat file, using the FCOPY function: filename in '<source folder>\<dataset name>.XML';
filename out '<destination folder>\<dataset name>.XML';
data _null_;
if fcopy('in','out') then do;
msg=sysmsg();
put msg;
end; else rc=fdelete('in'); run; This is also portable, and probably as fast as it gets. And as you can see, it was quite simpe to put in a check for successful copy before deleting the input. (3: Except if the source file is on the same physical disk as the archive folder, then you may get better performance using a native command to move the file, as it is only the reference to the file (the name of the directory) that needs to be changed, the actual file needs not be moved, But as others have already pointed out, you may not be allowed to use OS commands from your EG session anyway.)
... View more