## Weight and proc logistic

Solved
Occasional Contributor
Posts: 9

# Weight and proc logistic

```ods graphics on;
proc logistic data=sample outmodel = model_output plots(only)=roc;
model target(event = "1") = var1--var20;
weight w;
run;
ods graphics off;```

where w = 1 or 0;

Hello, if I run the above code, I'm hoping I'll fit a model based on the data where my weight variable is 1 and the output statistics will be where my weight variable is 0?

Will the roc plot include all my data or just where w = 1?

Thanks

Accepted Solutions
Solution
3 weeks ago
SAS Super FREQ
Posts: 3,839

## Re: Weight and proc logistic

[ Edited ]

Any observation that has weight=0 is excluded from the model and is not used in the fitting.  If you use an output statement such as

output out=out prob=prob resdev=resdev xbeta=xbeta;

then some statistics (such as PROB and XBETA) will be present for all observations, regardless of the weight value.

However, residuals (such as RESDEV), which depend on having a response value, will have missing values when weight=0 because those responses are not part of the data that were used to fit the model.

The ROC curve is composed of the points for which weight is NOT zero.  You can use the OUTROC= option on the MODEL statement to see the points used in the ROC curve.

All Replies
Solution
3 weeks ago
SAS Super FREQ
Posts: 3,839

## Re: Weight and proc logistic

[ Edited ]

Any observation that has weight=0 is excluded from the model and is not used in the fitting.  If you use an output statement such as

output out=out prob=prob resdev=resdev xbeta=xbeta;

then some statistics (such as PROB and XBETA) will be present for all observations, regardless of the weight value.

However, residuals (such as RESDEV), which depend on having a response value, will have missing values when weight=0 because those responses are not part of the data that were used to fit the model.

The ROC curve is composed of the points for which weight is NOT zero.  You can use the OUTROC= option on the MODEL statement to see the points used in the ROC curve.

☑ This topic is solved.