That will be a very big data.
if a variable has length 3=3*8 bytes=24 bytes which I think is the minimum length on PC or unix.
4**20*(4*24)=105,553,116,266,496 bytes
data test;
length var1 var2 var3 var4 var5 8;
run;
proc transpose data=test out=test_(keep=_name_);
var var1-var5;
run;
data _null_;
set test_ end=last nobs=nobs;
length code $1000. ;
retain code;
if _n_=1 then code="data wanted; do "||strip(_name_)||"=0,1,3,7;";
else code=trim(code)||"do "||strip(_name_)||"=0,1,3,7;";
if last then do;
code=trim(code)||'output;';
do i=1 to nobs;
code=trim(code)||'end;';
end;
code=trim(code)||'run;';
call execute(code);
end;
run;