Jeromy Anglim
Jeromy Anglim

Reputation: 34947

How to control the name of a saved variable from linear regression in SPSS?

When I run a multiple linear regression in SPSS, I want to save Mahalanobis distance. By default when I do this, SPSS adds a variable called MAH_1 to the data frame. I would like to indicate using syntax what that variable should be called. This would help make any example more reproducible if this variable were to be used in a subsequent analysis.

How do you control the name of the variable generated by linear regression in SPSS?

For example, here is some sample syntax:

REGRESSION
  /STATISTICS COEFF OUTS R ANOVA
  /DEPENDENT id
  /METHOD=ENTER IV1 IV2 IV3 IV4
  /SAVE MAHAL.

Is there some syntax which follows the MAHAL command which allows you to specify the name of the generated variable?

Upvotes: 1

Views: 158

Answers (1)

Jeromy Anglim
Jeromy Anglim

Reputation: 34947

I managed to seemingly answer the question with a little experimentation.

Writing the preferred name in parentheses after the saved object name generates the saved object with the preferred name. I.e., changing MAHAL to MAHAL(FOO), means that the saved values of Mahalanobis distance are now called foo instead of the default MAH_1.

REGRESSION
  /STATISTICS COEFF OUTS R ANOVA
  /DEPENDENT id
  /METHOD=ENTER IV1 IV2 IV3 IV4
  /SAVE MAHAL(foo).

And the section of the Help file for the save option in the regression command elaborates.

Upvotes: 1

Related Questions