?>Array ( [id] => 98 )
Scénario de test & Cas d'usage
Creation of a sales dataset with transactions from Germany and the USA.
| 1 | DATA casuser.GlobalSales; |
| 2 | INFILE DATALINES truncover; |
| 3 | INPUT TransactionID $ Amount Country $; |
| 4 | DATALINES; |
| 5 | TRN001 12500.75 DE |
| 6 | TRN002 8345.50 US |
| 7 | TRN003 999.99 DE |
| 8 | TRN004 150100.00 US |
| 9 | ; |
| 10 | RUN; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFmtLib / |
| 3 | fmtLibName='CurrencyFormats', |
| 4 | replace=true; |
| 5 | RUN; |
| 6 | QUIT; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFormat / |
| 3 | fmtLibName='CurrencyFormats' |
| 4 | fmtName='EUROFMT' |
| 5 | fmtType='PICTURE' |
| 6 | defaultL=20 |
| 7 | ranges={'low-high=000.000.000,00'} |
| 8 | prefix={'€ '} |
| 9 | locale='de_DE'; |
| 10 | RUN; |
| 11 | QUIT; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFormat / |
| 3 | fmtLibName='CurrencyFormats' |
| 4 | fmtName='USDFMT' |
| 5 | fmtType='PICTURE' |
| 6 | defaultL=20 |
| 7 | ranges={'low-high=0,000,000.00'} |
| 8 | prefix={'$'}; |
| 9 | RUN; |
| 10 | QUIT; |
| 1 | PROC CAS; |
| 2 | loadactionset 'datastep'; |
| 3 | RUN; |
| 4 | datastep.runCode / |
| 5 | code='data casuser.FormattedSales; set casuser.GlobalSales; length FormattedAmount $20; if Country="DE" then FormattedAmount = put(Amount, EUROFMT.); else if Country="US" then FormattedAmount = put(Amount, USDFMT.); run;'; |
| 6 | RUN; |
| 7 | TABLE.fetch / TABLE='FormattedSales'; |
| 8 | RUN; |
| 9 | QUIT; |
The 'FormattedSales' table should contain a 'FormattedAmount' column. For German transactions, amounts should be like '€ 12.500,75'. For US transactions, they should be like '$150,100.00'. This validates the creation and application of locale-specific picture formats.