Most SAS data steps stop when they read past the end of the input. So if you are reading from an empty dataset then any statement in the data step that is after the SET statement will never execute since the step stops as soon as it tries to read a non-existing observation.
So it sounds like you want to know if you can use the NOBS= option of the SET statement to populate a macro variable that you can later test. Since SAS will set the NOBS= variable's value while building the data step you can reference its value before the SET statement even executes.
%macro get_table_size(inset,macvar);
%if not %symexist(&macvar) %then %global &macvar;
data _null_;
call symputx("&macvar",size);
stop;
set &inset nobs=size;
run;
%mend;
Adding the test will make sure that the caller can reference the macro variable, even if they did not create it before calling.
Use the newer (better?) CALL SYMPUTX() function will make sure that the value does not have leading spaces or get converted to scientific notation when larger than 999,999,999,999.