SAS for customer retention/churn


I'm looking for some help in writing up SAS against the example customer file attached.

I would like help with how to write the code to decide what number of new customers in 2013 shopped again in 2014, and equally how many customers existing in 2013 did not shop in 2014

In this instance, Abby should be reviewed as someone who we didn't retain, and John as retained. (of course in our customer database because Abby didn;t plac an order there won;t be any line level data for her)

I had something else worked up (below) but not sure how to tweak it to achieve the above as I'm fairly new to SAS

much appreciated!

The below was simply to take a look at active/inactive status within a 12month horizon.

data ahart.Master_Email_Active_inactive;
set ahart.Master_Email_cleaned6;
by ID;
set ahart.Master_Email_cleaned6 ( firstobs = 2 keep = Order rename = (Order = Next_Order) )
ahart.Master_Email_cleaned6 ( obs = 1 drop = _all_ );
Prev_Order = ifn( first.ID, (.), lag(Order) );
Next_Order = ifn( last.ID, (.), Next_Order );

If Order>= Prev_Order and Order<=Prev_Order+365 then Active='Active';
else Active='Inactive';

Format Prev_Order ddmmyy10.;




Fortran must die
How do you tell in the data if someone is a new customer?

I think this could almost certainly be done easiest with PROC SQL and a where filter.