SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
jorge_garzon_co
Calcite | Level 5
Hola,
 
Al momento de ejecutar la macro que mueve los archivos antiguos y solo deja los nuevo, me saca error:
 
WARNING: In a call to the CATT function, the buffer allocated for the result was not long enough to contain the concatenation of
all the arguments. The correct result would contain 265 characters, but the actual result might either be truncated to 200
character(s) or be completely blank, depending on the calling environment. The following note indicates the left-most
argument that caused truncation.
NOTE: Argument 4 to function CATT('move "','\\10.32.4.74'[12 de 200 caracteres mostrados],'" "','\\10.32.4.74'[12 de 102 caracteres
mostrados],'"') at line 43 column 103 is invalid.
ERROR: Shell escape is not valid in this SAS session.
 
Captura de pantalla 2024-07-31 112140.png
 
A continuación dejo el código
 
/* MACRO MUEVE ARCHIVO ANTIGUO
******************************/
%macro move_old_files(ruta_origen, ruta_destino, archivo_reciente);
   data _null_;
    set file_list;
if fullpath ne "&archivo_reciente"
  then do;
  command = catt('move "', fullpath, '" "', "&ruta_destino",'"');
rc = system(command);
if rc = 0 then
   put "moved: " fullpath " to " "&ruta_destino";
   else
    put "failed to move: " fullpath " to " "&ruta_destino";
end;
run;
%mend move_old_files;
 
%move_old_files(&ruta_origen, &ruta_destino, &archivo_reciente);

 

5 REPLIES 5
mkeintz
PROC Star

@jorge_garzon_co 

 

"COD" is a very ambiguous topic title.  Do you have a question about the program you presented?

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
jorge_garzon_co
Calcite | Level 5
sorry, I already corrected the post,
ballardw
Super User

If you have ERRORS in the Log show the LOG with the code and the error messages.

 

 

ballardw
Super User

Talk to your SAS admim about the setting of XCMD or NOXCMD. If your admin has NOXCMD option set you cannot issue X commands and I believe that also affects the SYSTEM function or CALL SYSTEM call routines.

Kurt_Bremser
Super User

You work in a SAS session with option NOXCMD set.

Either have XCMD enabled by your SAS administrators, or use a combination of FCOPY and FDELETE functions to perform the move.

In the future, please post logs by cooy/pasting the text into a window opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

The "little running man" to the right is for posting SAS code. It provides coloring similar to the Enhanced Editor.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 800 views
  • 0 likes
  • 4 in conversation