Hi ,
I would like to move .txt files from one folder to another .
The txt files are like ab001.D170605.EDLY.txt
the following code is not working
%put x mv "&fpath/AB001.D&tdate..EDLY.TXT" &apath.;
x mv "&fpath/ET001.D&tdate..EDLY.TXT" &apath.;
where fpath = source location
apath=destination location
Steps to debug this:
1. Does it work in command line
2. Does it work without macros
3. Does it work with basic skeleton macro
4. What does not work mean?
So what was the answer to Q#1 and 2?
Also, you're using EG, did you confirm that XMCD is enabled?
could you please try the below code without the quotes to the path mentioned within the x command after the mv command
x "mv /data/DEVELOPMENT/LANDING/IN_FILES/ET001.D170605.EDLY.TXT /data/DEVELOPMENT/LANDING/ARCHIVED_IN";
That is why I always call operating system commands using PIPE instead of using X or %SYSEXEC. When you call the command using an INFILE with PIPE engine you can read the response from the operating system. If you had done that here you would have seem right away that the operating system did not understand the move command.
1 data _null_; 2 infile "move x y" pipe ; 3 input; 4 put _infile_; 5 run; NOTE: The infile "move x y" is: Pipe command="move x y" /bin/ksh: move: not found NOTE: 1 record was read from the infile "move x y". The minimum record length was 25. The maximum record length was 25.
@SAS_INFO Once tdate was defined it worked correctly for me.
So define tdate. And post your code using the editor and take some time to format the question. We take the time to answer your questions but it's easier if you organize your process clearly from the beginning.
%let tdate = %sysfunc(today(), yymmdd6.);
%put &tdate;
Hi Jag,
Tried the following and its working:
x "mv /data/DEVELOPMENT/LANDING/IN_FILES/ET002A.D170605.EDLY.TXT /data/DEVELOPMENT/LANDING/ARCHIVED_IN";
But I would like to use the macros for location and tdate of the file as:
x "mv &fpath/ET002A.&tdate..EDLY.TXT &apath";
where &tdate is todays date
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!
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.