Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Help with mining data

Accepted Solution Solved
Reply
Highlighted
Occasional Contributor
Posts: 11
Accepted Solution

Help with mining data

Hi, 

 

Good Morning!! Looking to get some help from the community. 

 

I have a dataset with transaction information for each customers and below is what the data looks like today. 

 

Customer id      Trans_date            Transaction Amount          Account Balance

12345                12-Nov-17              50                                     50

12345                14-Nov-17              40                                     90

12345                17-Nov-17              -25                                    65

23564                10-Nov-17              15                                     15

23564                18-Nov-17              15                                     30

 

Basically, every time a single transaction results in increase in account balance, is what I want to capture by customer id (highlighted in red). 

 

Looking for some expert advice and help. 

 

Thanks

 

--TJ


Accepted Solutions
Solution
3 weeks ago
Super User
Posts: 21,546

Re: Help with mining data

Posted in reply to BhararaTej

Use the DIF or LAG function to retreive the previous value or difference from previous value.

 

data want;
set have;

by customerID;

change=dif(account_balance);

if not first.customerId and change>0 then output;

run;

BhararaTej wrote:

Hi, 

 

Good Morning!! Looking to get some help from the community. 

 

I have a dataset with transaction information for each customers and below is what the data looks like today. 

 

Customer id      Trans_date            Transaction Amount          Account Balance

12345                12-Nov-17              50                                     50

12345                14-Nov-17              40                                     90

12345                17-Nov-17              -25                                    65

23564                10-Nov-17              15                                     15

23564                18-Nov-17              15                                     30

 

Basically, every time a single transaction results in increase in account balance, is what I want to capture by customer id (highlighted in red). 

 

Looking for some expert advice and help. 

 

Thanks

 

--TJ


 

View solution in original post


All Replies
Solution
3 weeks ago
Super User
Posts: 21,546

Re: Help with mining data

Posted in reply to BhararaTej

Use the DIF or LAG function to retreive the previous value or difference from previous value.

 

data want;
set have;

by customerID;

change=dif(account_balance);

if not first.customerId and change>0 then output;

run;

BhararaTej wrote:

Hi, 

 

Good Morning!! Looking to get some help from the community. 

 

I have a dataset with transaction information for each customers and below is what the data looks like today. 

 

Customer id      Trans_date            Transaction Amount          Account Balance

12345                12-Nov-17              50                                     50

12345                14-Nov-17              40                                     90

12345                17-Nov-17              -25                                    65

23564                10-Nov-17              15                                     15

23564                18-Nov-17              15                                     30

 

Basically, every time a single transaction results in increase in account balance, is what I want to capture by customer id (highlighted in red). 

 

Looking for some expert advice and help. 

 

Thanks

 

--TJ


 

Occasional Contributor
Posts: 11

Re: Help with mining data

Thanks.. I ended up using the lag function and this worked. 

 

--TJ

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 150 views
  • 1 like
  • 2 in conversation