问题已经解决了,请大家参考以下这个程序:
%if %sysfunc(fileexist(&myfilerf)) %then %let fid=%sysfunc(fopen(&myfilerf));%else %put The external file &myfilerf does not exist.;
我把%if %sysfunc(fileexist("C:\Projects\SAS\xxx.xls")) %then %do;放在判别条件中,然后就可以解决这个问题了,多谢大家关照以及帮助,期待多交流
又来麻烦大家了,这次呢,我使用宏变量读入一些excel数据,程序如下:
%let from=20120406;
%let to=20120409;
%macro citation(from,to);
data summary;
run;
%do i=&from. %to &to.;
(确保读入一个月的程序)
%if %sysfunc(mod(&i,100))>0 and %sysfunc(mod(&i,100))<=31 %then %do;
%Collection(&i)
%end;
%end;
%mend citation;
%macro Collection(a);
%macro Collection(a);
PROC IMPORT OUT= Financial_&a.
DATAFILE= "C:\Projects\ad hoc analysis\Portfolio related\Katrina_data_collection\&a._Financial"
DBMS=EXCEL REPLACE;
RANGE="Financial_Report$";
GETNAMES=YES;
MIXED=YES;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
data summary;
set summary
Financial_&a.;
run;
%mend Collection;
%citation(&from, &to);
我的问题是,在一个月中,比如说四月,有很多个周末或者假期,这些日子都是没有数据可以读入的,如何可以让程序自动监测到没有数据,然后避免读入这个数据呢?多谢咯
也就是说,如何利用数据是否存在做一个逻辑判别,恩,感激不尽