Hi Collogues,
I have the attached dataset.
Some customers have attrited the bank at different delinquency stages. For e.g.
Question
I need to identify these 3 things.
1). which month each customer (those who left) left the bank and at what stage each left.
Answer:
Account when left stage when they left
11 mth_8 current
55 mth_5 current
99 mth_12 1-30days
My approach:
I have first identified the missing value pattern using this.
data miss_pattern (drop=i);
set b.have;
array mychar(*) $ _character_;
do i=1 to dim(mychar);
if mychar(i) ="" then mychar{i}=1;
else mychar(i)=0;
end;
run;
Then I have manually gone to each place and identified the stage at which the customer left the bank.
This is just like doing it manually.
Could any one of you help me with an efficient approach.
Thanks
Mirisage
hi ... using your data set (assumes no intervening empty months) ...
data want;
set have;
array mth_(13);
if missing(mth_13) then do;
stage = coalescec(of mth_13 - mth_1);
when_left = vname(mth_(14 - cmiss(of mth_(*))));
end;
run;
account_ when_
num left stage
11 mth_8 CURRENT
22
33
44
55 mth_5 CURRENT
1000
66
77
88
99 mth_12 1-30days
Hi Mike,
Great!
This works pretty well and gives the correct answer.
Thank you very much.
Best regards
Mirisage
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.