SAS: getting the filesize of created DBF file

175 views Asked by At

I have SAS stored process that ceates DBF file from SAS data set rr_udf_value 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 variable F_SIZE is empty in STP log. But if after execution of STP I run 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, everithing is OK: F_SIZE=17342.

Why F_SIZE is not initialized while running STP, and how could I fix it?

Thanks in advance!

1

There are 1 answers

2
Joe On BEST ANSWER

filename() is restricted in environments with OPTION NOXCMD, which is by default set for server environments. This is for security reasons (as XCMD allows shell access). You can enable this with by enabling OPTION XCMD, though your server admin (if this is not you) would have to enable it on the server and not in your local session typically.

See the SAS documentation on XCMD for more information.