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
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.
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.