Scénario de test & Cas d'usage
Precise calculation of percentiles and quantiles.
Discover all actions of percentileCreation of a patient dataset with missing treatment group assignments and deliberately inserted extreme outliers for systolic blood pressure (systolic_bp).
| 1 | DATA casuser.clinical_trial; |
| 2 | call streaminit(789); |
| 3 | /* Normal Data */ |
| 4 | DO i = 1 to 200; |
| 5 | IF mod(i, 2) = 0 THEN treatment_group = 'A'; ELSE treatment_group = 'B'; |
| 6 | systolic_bp = rand('NORMAL', 120, 10); |
| 7 | OUTPUT; |
| 8 | END; |
| 9 | /* Missing Group Data */ |
| 10 | DO i = 1 to 50; |
| 11 | treatment_group = ''; |
| 12 | systolic_bp = rand('NORMAL', 125, 12); |
| 13 | OUTPUT; |
| 14 | END; |
| 15 | /* Extreme Outliers */ |
| 16 | treatment_group = 'A'; systolic_bp = 250; OUTPUT; |
| 17 | treatment_group = 'B'; systolic_bp = 40; OUTPUT; |
| 18 | treatment_group = 'A'; systolic_bp = 245; OUTPUT; |
| 19 | RUN; |
| 1 | |
| 2 | PROC CASUTIL; |
| 3 | load |
| 4 | DATA=casuser.clinical_trial outcaslib='casuser' casout='clinical_trial' replace; |
| 5 | QUIT; |
| 6 |
| 1 | PROC CAS; |
| 2 | percentile.boxPlot / |
| 3 | TABLE={name='clinical_trial', groupBy={'treatment_group'}}, |
| 4 | inputs={{name='systolic_bp'}}, |
| 5 | includeMissingGroup=true, |
| 6 | outliers=true, |
| 7 | nOutLimit=2, |
| 8 | whiskerPercentile=5, |
| 9 | casOut={name='bp_outliers', replace=true}; |
| 10 | RUN; |
The action produces two results. First, a summary statistics table that includes a separate row for the cohort with the missing 'treatment_group' value. Second, a new CAS table named 'bp_outliers' is created, containing exactly four rows: the two patients with the highest systolic_bp (250, 245) and the two with the lowest (40 and another low value from the normal distribution). This validates the handling of missing keys and advanced outlier detection.