Drop is a declarative statement that can't be executed conditionally, as it is meant to alter the data structure.
If you want to get rid of observattons with faulty entries, use a where condition, a subsetting if, or a conditional delete:
/* method with where */
date have;
set want;
where lengthn(cpr) ge 10;
run;
/* subsetting if */
date have;
set want;
if lengthn(cpr) ge 10;
run;
/* delete */
date have;
set want;
if lengthn(cpr) < 10 then delete;
run;
Drop is a declarative statement that can't be executed conditionally, as it is meant to alter the data structure.
If you want to get rid of observattons with faulty entries, use a where condition, a subsetting if, or a conditional delete:
/* method with where */
date have;
set want;
where lengthn(cpr) ge 10;
run;
/* subsetting if */
date have;
set want;
if lengthn(cpr) ge 10;
run;
/* delete */
date have;
set want;
if lengthn(cpr) < 10 then delete;
run;