Scénario de test & Cas d'usage
Precise calculation of percentiles and quantiles.
Discover all actions of percentileCreate a patient dataset with missing target values ('READMITTED_30D'). A 'PATIENT_WEIGHT' is assigned, giving higher weight to ICU patients. 'P_READMIT' is the model's predicted probability.
| 1 | DATA casuser.patient_readmission; |
| 2 | call streaminit(789); |
| 3 | DO PATIENT_ID = 1 to 2000; |
| 4 | ICU_STAY = rand('bern', 0.2); |
| 5 | IF ICU_STAY = 1 THEN DO; |
| 6 | PATIENT_WEIGHT = 2.5; |
| 7 | base_prob = 0.4; |
| 8 | END; |
| 9 | ELSE DO; |
| 10 | PATIENT_WEIGHT = 1.0; |
| 11 | base_prob = 0.15; |
| 12 | END; |
| 13 | P_READMIT = base_prob + rand('uniform')*0.2; |
| 14 | READMITTED_30D = rand('binomial', P_READMIT, 1); |
| 15 | /* Introduce missing targets for 5% of records */ |
| 16 | IF rand('uniform') < 0.05 THEN call missing(READMITTED_30D); |
| 17 | OUTPUT; |
| 18 | END; |
| 19 | RUN; |
| 1 | PROC CAS; |
| 2 | percentile.assess |
| 3 | TABLE={name='patient_readmission', caslib='casuser'}, |
| 4 | response='READMITTED_30D', |
| 5 | inputs={{name='P_READMIT'}}, |
| 6 | event='1', |
| 7 | weight='PATIENT_WEIGHT', |
| 8 | fitStatOut={name='readmit_fit_fail', caslib='casuser', replace=true}; |
| 9 | QUIT; |
| 1 | PROC CAS; |
| 2 | percentile.assess |
| 3 | TABLE={name='patient_readmission', caslib='casuser'}, |
| 4 | response='READMITTED_30D', |
| 5 | inputs={{name='P_READMIT'}}, |
| 6 | event='1', |
| 7 | weight='PATIENT_WEIGHT', |
| 8 | noMissingTarget=true, |
| 9 | includeFitStat=true, |
| 10 | fitStatOut={name='readmit_fit_weighted', caslib='casuser', replace=true}; |
| 11 | QUIT; |
The first step should produce a warning or error in the log indicating that missing values were found in the response variable. The second step should run successfully. The resulting 'readmit_fit_weighted' table will contain fit statistics (AUC, etc.) calculated only on the non-missing target observations, and these calculations will be influenced by the 'PATIENT_WEIGHT' variable, giving more influence to the high-risk ICU patients.