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
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
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
Thanks.. I ended up using the lag function and this worked.
--TJ
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.