SAS: get file size of generated DBF

I have a SAS stored process that interrupts a DBF file from a SAS rr_udf_value dataset and finds its size (F_SIZE):

filename dbfout "/SASInside/DBF/myfile";

proc export
   data=rr_udf_value
   outfile=dbfout
   dbms=dbf
   replace;
run; 

%let f_nm=/SASInside/DBF/myfile.DBF;

%let rc=%sysfunc(filename(onefile, &f_nm.));
%let fid=%sysfunc(fopen(&onefile));
%let F_SIZE=%sysfunc(finfo(&fid,File Size (bytes)));
%put &F_SIZE;

      

The problem is that the F_SIZE variable is empty in the STP log. But if after executing STP I run the commands

%let f_nm=/SASInside/DBF/myfile.DBF;

%let rc=%sysfunc(filename(onefile, &f_nm.));
%let fid=%sysfunc(fopen(&onefile));
%let F_SIZE=%sysfunc(finfo(&fid,File Size (bytes)));
%put FSIZE=&F_SIZE;

      

manually, everything is fine: F_SIZE = 17342.

Why is F_SIZE not initializing when STP starts and how can I fix it?

Thanks in advance!

+3


source to share


1 answer


filename()

limited in environments with OPTION NOXCMD

, which is the default for server environments. This is for security reasons (since it XCMD

allows shell access). You can enable this by enabling it OPTION XCMD

, although your server administrator (if not you) should have enabled it on the server and not your local session.



See the SAS documentation on XCMD for details .

+2


source







All Articles