> Yes, in the final table.
Correct me if I'm wrong but this
%macro default;
%do i = 1 %to 12;
data pd.default_contratos_&i (rename=estado_cliente=estado&i drop = t compress = yes);
set pd.default_contratos /*(obs=10)*/;
fecha=t-&i;
run;
proc sql;
create index
nupfec on pd.default_contratos_&i(nup,fecha);
quit;
data pd.tabla_cliente_ (compress=yes);
set output.tabla_cliente_;
set pd.default_contratos_&i (keep= nup fecha estado&i) key = nupfec / unique;
if _iorc_ > 0 then do;
_ERROR_ = 0;
call missing(estado&i);
end;
run;
;
%end;
%mend default;
%default;
looks like the same logic as
proc sql;
create index NUPT on pd.default_contratos(NUP,T);
quit;
data PD.TABLA_CLIENTE_ (compress=yes);
set OUTPUT.TABLA_CLIENTE_ ;
array ESTADO_[12];
FECHA=T;
do T=1 to 12;
T=FECHA-I;
set PD.DEFAULT_CONTRATOS(keep= NUP ESTADO) key = NUPT / unique;
ESTADO_[I]=ESTADO;
if _IORC_ > 0 then do;
_ERROR_ = 0;
ESTADO_[I]=.;
end;
output;
end;
run;
Am I wrong?
> Am I wrong?
Once we have all the logic in a single data step, we can look at shrinking the lookup data and using a hash table.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.