sequence cspade

Credit Card Transaction Analysis with Filtering

Scénario de test & Cas d'usage

Business Context

A bank is investigating potential credit card fraud patterns. They want to analyze transaction sequences only for 'High Risk' flagged accounts. The goal is to find transaction types that happen sequentially but with a significant delay (minimum gap), indicating a 'sleeper' fraud strategy.
Data Preparation

Generate transaction data including a risk profile column to be used for filtering.

Copied!
1 
2DATA mycas.card_transactions;
3LENGTH trans_type $15 risk_profile $10;
4INPUT account_id day trans_type $ risk_profile $;
5CARDS;
6101 1 ATM High 101 20 Online High 102 1 ATM Low 102 2 Online Low 103 5 Online High 103 30 Wire High 104 1 ATM High 104 2 Online High ;
7 
8RUN;
9 

Étapes de réalisation

1
Use the 'where' parameter to analyze only 'High' risk accounts and look for sequences with a minimum gap of 10 days.
Copied!
1 
2PROC CAS;
3sequence.cspade / TABLE={name='card_transactions', where='risk_profile="High"'} sequenceId='account_id' eventId='day' itemId='trans_type' minGap=10 supportCnt=1 casout={name='fraud_sequences', replace=true};
4 
5RUN;
6 

Expected Result


The analysis filters out account 102 (Low risk). It also ignores the rapid sequence of account 104 (gap=1). It successfully identifies the 'Online -> Wire' sequence of account 103 which fits the profile and timing constraints.