data have;
input name $ id;
cards;
a 4
b 2
c 3
d 5
e 7
f 14
;
proc sql;
create table miss_num as
select distinct tot_num-num_have as num_miss
from (select max(id)-min(id)+1 as tot_num from have) as a
,(select count(distinct id) as num_have from have) as b
;
quit;
*** Applicable when the max value of id is not too big;
proc sql;
create table miss_list as
select distinct varnum as id from dictionary.columns
where varnum<(select max(id) from have)
and varnum>(select min(id) from have)
and varnum not in (select distinct id from have);
quit;