Scénario de test & Cas d'usage
Creation of a 'products' dataset simulating sales with Type, Origin, and MSRP.
| 1 | |
| 2 | DATA casuser.products; |
| 3 | call streaminit(12345); |
| 4 | DO i=1 to 1000; |
| 5 | IF rand('UNIFORM') > 0.5 THEN Origin='USA'; |
| 6 | ELSE Origin='Asia'; |
| 7 | IF rand('UNIFORM') > 0.3 THEN Type='Sedan'; |
| 8 | ELSE Type='SUV'; |
| 9 | MSRP = round(rand('NORMAL', 30000, 5000)); |
| 10 | OUTPUT; |
| 11 | END; |
| 12 | |
| 13 | RUN; |
| 14 |
| 1 | |
| 2 | PROC CAS; |
| 3 | SIMPLE.crossTab / TABLE={name='products', caslib='casuser'} row='Type' col='Origin' weight='MSRP' aggregator='SUM'; |
| 4 | |
| 5 | RUN; |
| 6 |
A crosstabulation table where the cell values represent the total revenue (sum of MSRP) for each car type and origin, rather than the frequency of rows.