BookmarkSubscribeRSS Feed
Mirisage
Obsidian | Level 7

Hi Collogues,

I have the attached dataset.

Some customers have attrited the bank at different delinquency stages. For e.g.

  • Account_num 11 has left the bank by 8th month while at “current” stage.
  • Account_num 55 left the bank by 5th month while at “current” stage.
  • Account 99 at 12th month while he was at “1-30days” delinquency stage.

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

2 REPLIES 2
MikeZdeb
Rhodochrosite | Level 12

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

Mirisage
Obsidian | Level 7

Hi Mike,

Great!

This works pretty well and gives the correct answer.

Thank you very much.

Best regards

Mirisage

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 2 replies
  • 766 views
  • 1 like
  • 2 in conversation