saslogistic-regressionlogistics

How to print the the Somers'D in a SAS dataset?


As the title suggests, I wonder about there's a way to print the Somers'D statistics and the p-value of the predictor x in a dataset.

You can get such statistics by simply running:

ODS TRACE ON;
PROC LOGISTIC DATA = BETTING.TRAINING_DUMMIES NOPRINT; 
    MODEL Z1 (EVENT = '1') = D_INT_LNGAP_1;
        OPTIONS;
RUN;

ODS TRACE OFF;

ODS OUTPUT FITSTATISTICS=FITDS;
PROC LOGISTIC DATA = BETTING.TRAINING_DUMMIES NOPRINT; 
    MODEL Z1 (EVENT = '1') = D_INT_LNGAP_1;
        OPTIONS;
RUN;

If I run a similar code to the one proposed here, I get only the AIC, the SIC and finally the LR stat and in the SAS log I find:

10   ODS TRACE ON;
11
12   PROC LOGISTIC DATA = BETTING.TRAINING_DUMMIES NOPRINT;
13       MODEL Z1 (EVENT = '1') = D_INT_LNGAP_1;
14           OPTIONS;
15   RUN;

NOTE: PROC LOGISTIC is modeling the probability that z1=1.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: There were 3968 observations read from the data set BETTING.TRAINING_DUMMIES.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           0.07 seconds
      cpu time            0.04 seconds


16
17   ODS TRACE OFF;

in the first piece of code, while in the second I find the following:

18   ODS OUTPUT FITSTATISTICS=FITDS;
NOTE: Writing HTML Body file: sashtml.htm
19   PROC LOGISTIC DATA = BETTING.TRAINING_DUMMIES NOPRINT; 
20       MODEL Z1 (EVENT = '1') = D_INT_LNGAP_1;
21           OPTIONS;
22   RUN;

NOTE: PROC LOGISTIC is modeling the probability that z1=1.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
NOTE: There were 3968 observations read from the data set BETTING.TRAINING_DUMMIES.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds

WARNING: Output 'FITSTATISTICS' was not created.  Make sure that the output object name, label,
         or path is spelled correctly.  Also, verify that the appropriate procedure options are
         used to produce the requested output object.  For example, verify that the NOPRINT
         option is not used.

Some of you can suggest a way to to print such statistics in a new dataset?

Any help will be appreciated.

Thanks!


Solution

  • I don't know why you're not getting ODS TRACE output. I'd restart your SAS version or report it to SAS.

    The tables you want are called Association and ParameterEstimates. Somer's D requires the Odds Ratio statement to be created.

    ods trace on;
    ods output association=somers parameterestimates=pe;
    proc logistic data=sashelp.heart;
    model status=ageatstart;
    oddsratio ageatstart;
    run;
    ods trace off;