Scénario de test & Cas d'usage
Network analysis and graph algorithms.
Discover all actions of optNetworkCreation of a transaction table representing transfers between accounts, forming two distinct suspicious rings and one isolated pair.
| 1 | |
| 2 | DATA mycas.transactions; |
| 3 | LENGTH from_acc $10 to_acc $10; |
| 4 | INPUT from_acc $ to_acc $ amount; |
| 5 | DATALINES; |
| 6 | ACC_A01 ACC_A02 5000 ACC_A02 ACC_A03 4500 ACC_A03 ACC_A01 4000 ACC_B01 ACC_B02 9000 ACC_B02 ACC_B03 8500 ACC_B03 ACC_B04 2000 ACC_B04 ACC_B01 1500 ACC_X99 ACC_X98 100 ; |
| 7 | |
| 8 | RUN; |
| 9 |
| 1 | |
| 2 | PROC CAS; |
| 3 | loadtable caslib='casuser' path='transactions.sashdat'; |
| 4 | |
| 5 | RUN; |
| 6 |
| 1 | |
| 2 | PROC CAS; |
| 3 | optNetwork.connectedComponents links={name='transactions', vars={from='from_acc', to='to_acc'}} outNodes={name='account_groups', replace=true} out={name='group_stats', replace=true}; |
| 4 | |
| 5 | RUN; |
| 6 |
The action should generate two output tables. 'account_groups' will map every account (e.g., ACC_A01) to a specific component ID (e.g., 1). 'group_stats' will summarize these components, revealing that there are 3 distinct groups (The 'A' ring, the 'B' ring, and the 'X' pair) and providing the number of nodes (accounts) in each.