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 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
  • 5 replies
  • 550 views
  • 0 likes
  • 4 in conversation