Hi everyone, I need to write a code that can generate gini coeff. for every variable and create an example table like this; example: Predictor Gini Coef CC_RSK_AMT 0,7 CC_APP_CNT_L12M 0,6 OD_APP_CNT_L12M 0,4 CNSMR_APP_CNT_L12M 0,266666667 MRTG_APP_CNT_L12M 0,116666667 BANKA_SAY 0,6 TOPLAM_RISK_MEMZUC 0,6 TOPLAM_RISK_MEMZUC_2 0,6 LIMIT_ALL 0,6 LIMIT_2 0,6 LIMIT_ORAN 0,6 RISK_ORAN 0,6 and my code is ; data your_data; set WORK.GINI_COEFF_DENEME; run; %let predictors = CC_RSK_AMT CC_APP_CNT_L12M OD_APP_CNT_L12M CNSMR_APP_CNT_L12M MRTG_APP_CNT_L12M BANKA_SAY TOPLAM_RISK_MEMZUC TOPLAM_RISK_MEMZUC_2 LIMIT_ALL LIMIT_2 LIMIT_ORAN RISK_ORAN; * Initialize the Gini coefficient table with necessary columns; data gini_table; length Predictor $50. Gini_Coef 8.; keep Predictor Gini_Coef; run; %macro calculate_gini; %let i = 1; %let predictor = %scan(&predictors, &i); %do %while(&predictor ne ); * Run logistic regression for the current predictor; proc logistic data=your_data; model FIY_HAS_F(event='1') = &predictor; roc 'ROC' &predictor; ods output ROCInfo=roc_info; run; * Check if the model converged; data _null_; set roc_info; if _N_ = 1 then call symputx('model_converged', '1'); else call symputx('model_converged', '0'); run; %if &model_converged = 0 %then %do; %put WARNING: Model did not converge for predictor &predictor; %let i = %eval(&i + 1); %let predictor = %scan(&predictors, &i); %continue; %end; * Extract the AUC from the ROCInfo table and calculate Gini coefficient; data auc_data(keep=Predictor Gini_Coef); set roc_info; if ROCModel = 'ROC' and ROCType = 'C'; auc = C; Gini_Coef = 2 * auc - 1; Predictor = "&predictor"; output; run; * Append the Gini coefficient of the current predictor to the Gini table; proc append base=gini_table data=auc_data force; run; * Move to the next predictor; %let i = %eval(&i + 1); %let predictor = %scan(&predictors, &i); %end; %mend calculate_gini; * Run the macro to calculate Gini coefficients for all predictors; %calculate_gini; * View the Gini coefficient table; proc print data=gini_table; var Predictor Gini_Coef; run; But it keeps giving this warning and then error: WARNING: Output 'ROCInfo' 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 ERROR: File WORK.ROC_INFO.DATA does not exist. Can any one please please help me?
... View more