SAS processing of empty files is well documented on their support page. Code I've used successfully in the past is:
%LET DNAME=DUMMY; /* NAME OF SAS DATA SET TO CHECK */
IF 0 THEN SET &DSN NOBS=COUNT;
%IF &ONE NE 0 %THEN %DO;
TITLE "THE &DNAME DATA SET";
PROC PRINT DATA=&DNAME;
%PUT WARNING: THE DATA SET IS EMPTY ;
The issue with your code is that it won't work. You need to use something like what I've posted because of the way SAS handles empty files; it won't let you do the processing of the DATA step as you posted unless there's at least one record in the file. If you don't use a macro, empty file processing won't work in SAS -- check the support & training section of www.sas.com to find multiple ways of handling empty files -- none of which use your technique.