?>Array ( [id] => 97 )
Scénario de test & Cas d'usage
Creation of a small customer dataset with credit scores. This table will be loaded into CAS to test the format application.
| 1 | DATA casuser.CustomerScores; |
| 2 | INFILE DATALINES; |
| 3 | INPUT CustomerID Score; |
| 4 | DATALINES; |
| 5 | 101 820 |
| 6 | 102 745 |
| 7 | 103 650 |
| 8 | 104 580 |
| 9 | 105 999 |
| 10 | 106 350 |
| 11 | ; |
| 12 | RUN; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFmtLib / |
| 3 | fmtLibName='RiskFormats', |
| 4 | replace=true; |
| 5 | RUN; |
| 6 | QUIT; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFormat / |
| 3 | fmtLibName='RiskFormats' |
| 4 | fmtName='ScoreFmt' |
| 5 | ranges={'300-579=High Risk', '580-669=Fair Risk', '670-799=Good Risk', '800-850=Excellent', 'other=Review'}; |
| 6 | RUN; |
| 7 | QUIT; |
| 1 | PROC casutil; |
| 2 | load DATA=casuser.CustomerScores outcaslib='casuser' casout='CustomerScores' replace; |
| 3 | QUIT; |
| 4 | PROC CAS; |
| 5 | TABLE.fetch / |
| 6 | TABLE='CustomerScores', |
| 7 | FORMAT=true, |
| 8 | vars={'CustomerID', 'Score'}, |
| 9 | formatDef={name='Score', FORMAT='ScoreFmt'}; |
| 10 | RUN; |
| 11 | QUIT; |
The final fetched table should display a new formatted column for 'Score'. For example, customer 101 with a score of 820 should display 'Excellent', customer 103 with 650 should display 'Fair Risk', and customer 105 with 999 should display 'Review', demonstrating the 'other' keyword works correctly.