You can make a MACRO:
%let dsid=%sysfunc(open(input));
%let nobs=%sysfunc(attrn(&dsid,nlobs));
%let dsid=%sysfunc(close(&dsid));
%if &nobs ne 0 %then %do;
ods graphics / reset=INDEX height=5in width=6in imagefmt=png imagename="F" border=off;
proc sgplot data=input ...........................
%end;
%else %do;
proc sgplot data=DUMMY..............
%end;
... View more