I everyone, im triying to make this code work on server, but it shows me the next error: WARNING: Argument 1 to function DNUM referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range. NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set to a missing value. ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &dnum ERROR: The %TO value of the %DO I loop is invalid. ERROR: The macro READ_FILES will stop executing. 89 Nevertheless, if i run the same code but with local, i dont get any error, everything works fine. Any clues? Many thanks! BTW This is the code i'm using: %let dir = C:\Users\....; libname INSUMOS "/SASDATA/...../"; %let libreria=INSUMOS.; options compress=yes; %macro read_files (dir, LIBRERIA); %let rc=%sysfunc(filename(rawdata,&dir)); %let did=%sysfunc(dopen(&rawdata)); %let dnum=%sysfunc(dnum(&did)); %do i=1 %to &dnum; %let name_file=%sysfunc(dread(&did,&i)); %let FORMATO=%sysfunc(scan(&name_file,2,.)); %if &FORMATO=xlsx %then %do; %let name_file_short=%sysfunc(scan(&name_file,1,.)); data _NULL_; *Extrae el nombre del archivo; FECHA=scan("&name_file_short",-1,"_"); call symput('FECHA', FECHA); run; PROC IMPORT OUT=&LIBRERIA.&name_file_short / DATAFILE="&dir\&name_file" DBMS=xlsx REPLACE; run; Data &libreria&name_file_short; SET &libreria&name_file_short; FECHA_NOMBRE= "&name_file_short"; FECHA2="&FECHA"; FECHA=input(FECHA2,DDMMYY8.); FORMAT FECHA DATE9.; DROP FECHA2; if RFC = " " then delete; RUN; %end; %end; data INSUMOS.tot_comb; set &LIBRERIA.EC:; run; %mend; %read_files(&dir, &libreria);
... View more