**Variable Selection based on Univariate Analysis (Wald Chi-Square and Standardized Coefficient)**

PROC LOGISTIC is run on each of the variables and tracking p-value of wald chi-square and standardized coefficient,

%macro perf(data=,targetvar=,vars=,output=);

%let n=%sysfunc(countw(&vars));

%do i=1 %to &n;

%let val = %scan(&vars,&i);

ods select none;

ods output ParameterEstimates=Estimate&i;

proc logistic data=&data;

model &targetvar(event='1')=&val / stb;

run;

data Estimate&i;

set Estimate&i;

length Sig $15;

where Variable NE 'Intercept';

if ProbChiSq < .05 then Sig ='Significant';

else if ProbChiSq >= .05 then Sig = 'Non-Significant';

help = abs(StandardizedEst);

run;

%end;

data &output;

set Estimate1 - Estimate&n;

run;

proc datasets library=work

nodetails nolist;

delete Estimate1 - Estimate&n;

run;

quit;

proc sort data = &output;

by descending help;

run;

data &output;

set &output (drop = help DF);

run;

%mend perf;

options symbolgen mlogic;

%perf(data=imputed ,targetvar= ins,vars= mmbal income ilsbal posamt ,output= resultf);

%macro perf(data=,targetvar=,vars=,output=);

%let n=%sysfunc(countw(&vars));

%do i=1 %to &n;

%let val = %scan(&vars,&i);

ods select none;

ods output ParameterEstimates=Estimate&i;

proc logistic data=&data;

model &targetvar(event='1')=&val / stb;

run;

data Estimate&i;

set Estimate&i;

length Sig $15;

where Variable NE 'Intercept';

if ProbChiSq < .05 then Sig ='Significant';

else if ProbChiSq >= .05 then Sig = 'Non-Significant';

help = abs(StandardizedEst);

run;

%end;

data &output;

set Estimate1 - Estimate&n;

run;

proc datasets library=work

nodetails nolist;

delete Estimate1 - Estimate&n;

run;

quit;

proc sort data = &output;

by descending help;

run;

data &output;

set &output (drop = help DF);

run;

%mend perf;

options symbolgen mlogic;

%perf(data=imputed ,targetvar= ins,vars= mmbal income ilsbal posamt ,output= resultf);

## Post a Comment