Scénario de test & Cas d'usage
Create a dataset with missing values (nulls) and a weighting variable. 'Response' is missing for 10% of records.
| 1 | |
| 2 | DATA mycas.clinical_study; |
| 3 | call streaminit(456); |
| 4 | DO i=1 to 200; |
| 5 | Demog_Weight = rand('uniform', 0.5, 1.5); |
| 6 | Dosage = rand('integer', 50, 200); |
| 7 | Response = (Dosage * 0.8) + rand('normal', 0, 10); |
| 8 | IF rand('uniform') < 0.1 THEN Response = .; |
| 9 | OUTPUT; |
| 10 | END; |
| 11 | |
| 12 | RUN; |
| 13 |
| 1 | |
| 2 | PROC CAS; |
| 3 | SIMPLE.correlation TABLE={name='clinical_study'} inputs={'Dosage', 'Response'} weight='Demog_Weight' listwiseDelMiss=true varianceDivisor='WEIGHT'; |
| 4 | |
| 5 | RUN; |
| 6 |
The output correlation matrix is calculated using the specified weights. The number of observations used is less than the total input rows (200), confirming that rows with missing 'Response' values were successfully excluded (listwise deletion). The variance/covariance calculations utilize the sum of weights divisor as requested.