BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ChrisNZ
Tourmaline | Level 20

> 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?

ChrisNZ
Tourmaline | Level 20

> 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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 16 replies
  • 1151 views
  • 10 likes
  • 5 in conversation