Scénario de test & Cas d'usage
Creation of a customer table with specific formats and labels.
| 1 | |
| 2 | DATA casuser.customers_campaign; |
| 3 | LENGTH CustomerName $50 Region $20; |
| 4 | INPUT CustomerID CustomerName $ Age Region $ LastPurchaseDate :date9.; |
| 5 | FORMAT LastPurchaseDate date9.; |
| 6 | label Region='Geographic Sales Region'; |
| 7 | CARDS; |
| 8 | 101 'Alice Brown' 34 'North-East' 15JAN2023 102 'Bob White' 45 'South-West' 28FEB2023 ; |
| 9 | |
| 10 | RUN; |
| 11 |
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.columnInfo RESULT=r / TABLE={name='customers_campaign', caslib='casuser'}; |
| 4 | PRINT r; |
| 5 | |
| 6 | QUIT; |
| 7 |
| 1 | |
| 2 | PROC CAS; |
| 3 | TABLE.columnInfo RESULT=r / TABLE={name='customers_campaign', caslib='casuser'} inputs={'Region', 'LastPurchaseDate'}; |
| 4 | PRINT r; |
| 5 | |
| 6 | QUIT; |
| 7 |
The first step returns a table listing all 5 columns with their types (double, char). The second step returns a filtered table showing only 'Region' and 'LastPurchaseDate', confirming the label 'Geographic Sales Region' and the format 'DATE9.'.