?>Array ( [id] => 99 )
Scénario de test & Cas d'usage
Creation of a dataset with sensor temperature readings, including values that are exactly on, or slightly outside of, the defined range boundaries.
| 1 | DATA casuser.SensorReadings; |
| 2 | INFILE DATALINES; |
| 3 | INPUT SensorID $ Temperature; |
| 4 | DATALINES; |
| 5 | S01 75.0 |
| 6 | S02 90.0 |
| 7 | S03 90.001 |
| 8 | S04 110.0 |
| 9 | S05 110.05 |
| 10 | S06 . |
| 11 | ; |
| 12 | RUN; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFmtLib / |
| 3 | fmtLibName='SensorFormats', |
| 4 | replace=true; |
| 5 | RUN; |
| 6 | QUIT; |
| 1 | PROC CAS; |
| 2 | ACTION sessionProp.addFormat / |
| 3 | fmtLibName='SensorFormats' |
| 4 | fmtName='TempState' |
| 5 | fuzz=0.1 |
| 6 | ranges={'low-90=Normal', '90<-110=Warning', '110<-high=Critical'}; |
| 7 | RUN; |
| 8 | QUIT; |
| 1 | PROC casutil; |
| 2 | load DATA=casuser.SensorReadings outcaslib='casuser' casout='SensorReadings' replace; |
| 3 | QUIT; |
| 4 | PROC CAS; |
| 5 | TABLE.fetch / |
| 6 | TABLE='SensorReadings', |
| 7 | FORMAT=true, |
| 8 | vars={'SensorID', 'Temperature'}, |
| 9 | formatDef={name='Temperature', FORMAT='TempState'}; |
| 10 | RUN; |
| 11 | QUIT; |
The fetched table should show the formatted 'Temperature' values. Sensor S02 (90.0) should be 'Normal'. Sensor S03 (90.001), which is just above 90, should be categorized as 'Warning' due to the fuzz factor. Sensor S05 (110.05) should be 'Critical'. The missing value for S06 should remain unformatted. This validates that the fuzz parameter correctly handles boundary conditions.