What types of values would DATE8. format generate? DATE needs 9 characters, 2 for day, 3 for month and 4 for year.
Use DATE9.
Don't use the old style CALL SYMPUT(). Use the newer CALL SYMPUTX() instead.
if the input dataset is empty the step will stop at the SET statement and never get to the CALL SYMPUTX() statement. So write the value of NOBS macro variable BEFORE the SET statement. And make sure to define TEMPDATE macro variable in case there are no observations in the dataset. No need to read the whole dataset.
%let tempdate=UNKNOWN;
data _null_;
call symputX("nobs", n);
set mylib.test1 nobs=n;
call symputX("tempdate",put(Date, date9.));
stop;
run;
... View more