I've just noticed a minor inefficiency in the code that I copied from my old post: If N happens to be a power of 2 (2, 4, 8, 16, ...), view BASE creates 2N observations, while N would be sufficient. This can be avoided by replacing int(log2(&N)-1) with ceil(log2(&N)-2):
%let N=100;
proc sql noprint;
create table seed (x num);
insert into seed
set x=0
set x=1;
select 'seed'||repeat(',seed',ceil(log2(&N)-2)) into :ds
from seed;
create view base as
select ' ' from &ds;
create table want(where=(i<=&N)) as
select monotonic() as i from base;
quit;
... View more