Scénario de test & Cas d'usage
Creation of a customer transaction dataset with purchase amounts and tenure in months.
| 1 | |
| 2 | DATA casuser.live_transactions; |
| 3 | call streaminit(123); |
| 4 | DO i = 1 to 1000; |
| 5 | CustomerID = i; |
| 6 | Amount = rand('Uniform') * 1000; |
| 7 | Tenure_Months = floor(rand('Uniform') * 60); |
| 8 | OUTPUT; |
| 9 | END; |
| 10 | |
| 11 | RUN; |
| 12 |
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.copyTable / TABLE={name='live_transactions', caslib='casuser', where='Amount > 500', computedVars={{name='Loyalty_Score', label='Score'}}, computedVarsProgram='Loyalty_Score = Tenure_Months * 10; |
| 4 | '}, casout={name='marketing_snapshot', caslib='casuser', replace=true}; |
| 5 | |
| 6 | RUN; |
| 7 |
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.fetch / TABLE={name='marketing_snapshot', caslib='casuser', to=5}; |
| 4 | |
| 5 | RUN; |
| 6 |
A new table 'marketing_snapshot' is created containing only rows where Amount > 500. It includes a new column 'Loyalty_Score' correctly calculated. The original table remains untouched.