You might be able to solve your problem via using the excel engine in a libname statement. When I tried the following code, a blank spreadsheet was shown with one column, namely F1. As such, the code borrowed from support.sas.com allowed one to see if such a variable exists. As long as your real data doesn't contain such a variable, it might provide the basis of a solution:
libname t1 "c:\test.xls";
data _null_;
dsid=open("t1.'sheet1$'n");
check=varnum(dsid,'f1');
if check=0 then put 'Variable does not exist';
else put 'Variable is located in column ' check +(-1) '.';
run;
HTH,
Art
-----------
> Hi,
>
> I have several excel workbook with multiple sheets
> that I'm dynamically loading. I have a couple of the
> workbooks that have a spreadsheets that are blank.
> This fails to load correctly as the dataset has no
> rows but does get created with data issues. I've
> tried %sysfunc(exist( but doesn't work correctly as
> the dataset does get created. How can I get this to
> work? I tried using an array to check and set a
> variable to skip it also. The array says the array
> is empty and stops.
>
> data _null_;
> set &&sheet&i;
> array _c{*} _character_;
> array _n{*} _numeric_;
> if missing(coalesceC(of _c{*})) and
> missing(coalesce(of _n{*})) then do;
> call symputx('emptyds','Y');
> end;
> else do;
> call symputx('emptyds','N');
> end;
> run;