simple correlation

Weighted Clinical Analysis with Missing Data Handling

Scénario de test & Cas d'usage

Business Context

A pharmaceutical company is conducting a clinical trial analysis. The dataset contains patient vitals and drug response rates. However, the data is 'dirty': some patients dropped out (missing values), and the study design requires weighting patients based on demographic representation (Sample Weights). The analysis must strictly exclude any incomplete records to meet regulatory standards.
Data Preparation

Create a dataset with missing values (nulls) and a weighting variable. 'Response' is missing for 10% of records.

Copied!
1 
2DATA mycas.clinical_study;
3call streaminit(456);
4DO i=1 to 200;
5Demog_Weight = rand('uniform', 0.5, 1.5);
6Dosage = rand('integer', 50, 200);
7Response = (Dosage * 0.8) + rand('normal', 0, 10);
8IF rand('uniform') < 0.1 THEN Response = .;
9OUTPUT;
10END;
11 
12RUN;
13 

Étapes de réalisation

1
Run the correlation analysis using 'Demog_Weight' for weighting, applying listwise deletion for missing values, and using the sum of weights (WEIGHT) as the variance divisor.
Copied!
1 
2PROC CAS;
3SIMPLE.correlation TABLE={name='clinical_study'} inputs={'Dosage', 'Response'} weight='Demog_Weight' listwiseDelMiss=true varianceDivisor='WEIGHT';
4 
5RUN;
6 

Expected Result


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.