You should specify the date9. format in the first data step - see below. Also, I think you can do the where clause in the same data step as well. data a; set casesdat.cases; format discharge date9.; discharge = DatePart(Date_Discharged); where '01jan2020'd <= discharge <= '20dec2020'd; run;
... View more