1
votes

I am running multiple interations of sequence containing proc reg and proc score. How do I automatically pass predictors from proc reg to var list in proc score? I know in proc reg, outest outputs a dataset that contains all the variables with predictors being populated with estimates. In that dataset, non predictors have a missing value. Does proc reg allows for an easy way to capture just the predictor variables?

Thanks!

1
Can you provide example code that gives you missing values in the OUTEST= data set?DomPazz

1 Answers

1
votes

One way to go about this would be to use macro variables.

%let varlist = x1 x2 x3 x4;

proc reg data = somedata outest = out;
    model y = &varlist;
run;
quit;

data _null_;
    length newvars $ 2000;
    set out;
    array v{*} &varlist;
    do i = 1 to dim(v);
        if v[i] ne . then newvars = catx(" ", newvars, vname(v[i]));
    end;
    call symputx("newvars", newvars);
run;

%put Predictors=&newvars;

proc score data = somedata;
    var &newvars;
run;

This creates a space delimited list of the predictors from PROC REG and uses that list in the VAR statement in PROC SCORE. This approach assumes you have only a single model in your OUTEST dataset. But if that is indeed the case, you shouldn't have any missing values for your predictor variables in the OUTEST dataset.