Andres Mora
Andres Mora

Reputation: 1106

how to label regression models?

Im running 2 different regressions from the same dataset. I would like to name them differently to prevent confusion. How can i assign the label name

proc reg data = main outest = main_regression1;
model x= a b c;
run ;

proc reg data = main outest = main_regression2;
model x= a b d;
run ;

data regression_summary ;
set main_regression1 main_regression2 ;
run ;

enter image description here

Upvotes: 0

Views: 455

Answers (2)

Stu Sztukowski
Stu Sztukowski

Reputation: 12909

You can add multiple models within a single proc reg and assign each one a label.

proc reg data = main outest = est;
    FirstModel:  model x = a b c;
    SecondModel: model x = a b d;
run;

Output of est:

_MODEL_       _TYPE_    ...
FirstModel    PARMS     ...
SecondModel   PARMS     ...

Upvotes: 2

LuizZ
LuizZ

Reputation: 1044

You can use the (in=) option to create a temporary flag variable and then assign a value to it in another variable. For example:

data regression_summary ;
set main_regression1 (in=A) main_regression2 ;
if A=1 then LABEL = "Model 1";
else if A=0 then LABEL = "Model 2";
run ;

Upvotes: 1

Related Questions