Scénario de test & Cas d'usage
Configuration of session properties.
Discover all actions of sessionPropCreate a control data set for customer segmentation formats (age and region) and a sample customer table.
| 1 | /* Create formats in WORK */ |
| 2 | PROC FORMAT; |
| 3 | value $regionfmt 'NA'='North America' 'EU'='Europe' 'AS'='Asia' other='Other'; |
| 4 | value agegroupfmt low-24='Gen Z' 25-40='Millennial' 41-55='Gen X' 56-high='Boomer'; |
| 5 | RUN; |
| 6 | |
| 7 | /* Create control data set from formats */ |
| 8 | DATA work.marketing_formats_ctl; |
| 9 | SET sashelp.vformat; |
| 10 | where fmtname in ('REGIONFMT', 'AGEGROUPFMT'); |
| 11 | RUN; |
| 12 | |
| 13 | /* Create sample customer data */ |
| 14 | DATA work.customer_list; |
| 15 | LENGTH CustomerID $ 10 Region $ 2; |
| 16 | INPUT CustomerID Region Age; |
| 17 | DATALINES; |
| 18 | CUST001 NA 35 |
| 19 | CUST002 EU 50 |
| 20 | CUST003 NA 22 |
| 21 | CUST004 AS 68 |
| 22 | CUST005 XX 45 |
| 23 | ; |
| 24 | RUN; |
| 1 | PROC CASUTIL; |
| 2 | load DATA=work.marketing_formats_ctl outcaslib='casuser' casout='marketing_formats_table' replace; |
| 3 | load DATA=work.customer_list outcaslib='casuser' casout='customer_list_cas' replace; |
| 4 | QUIT; |
| 1 | PROC CAS; |
| 2 | sessionProp.addFmtLib / |
| 3 | caslib='casuser' |
| 4 | name='marketing_formats_table' |
| 5 | fmtLibName='MarketingLib'; |
| 6 | RUN; |
| 1 | PROC CAS; |
| 2 | SIMPLE.freq / |
| 3 | TABLE={name='customer_list_cas', caslib='casuser'} |
| 4 | inputs={{name='Age', FORMAT='AGEGROUPFMT'}, {name='Region', FORMAT='REGIONFMT'}}; |
| 5 | RUN; |
The `simple.freq` action should produce two frequency tables. The first table for 'Age' will show counts grouped by the 'agegroupfmt' labels ('Millennial', 'Gen X', 'Gen Z', 'Boomer'). The second table for 'Region' will show counts grouped by the '$regionfmt' labels ('North America', 'Europe', 'Asia', 'Other'). This confirms the 'MarketingLib' format library was successfully loaded and applied.