SPSS Statistics

 View Only
  • 1.  Somewhat unexpected transformation logic

    Posted Mon May 08, 2023 09:51 AM

    I use the Windows version of SPSS 29.

    When I use a transformation like

    compute  x=x+3.

    and 'x' does not exist in the active data set, I would expect SPSS to issue an error message (since one of the elements on the right side of the equal sign is non-existant). Instead, SPSS generates a new variable 'x' that is system-missing for all cases, without generating any message.

    Has this been the behavior of SPSS in previous versions as well (I can't test because both of my computers run version 29)? How can you compute a variable from a variable that does not exist? Clearly,

    compute y=x+3.

    gives an error message if 'x' does noit exist - but isn't the situation the same as in the example above?

    Frank Furter

  • 2.  RE: Somewhat unexpected transformation logic

    IBM Champion
    Posted Mon May 08, 2023 10:42 AM
    I think the answer is that there is an implicit NUMERIC x statement executed before the compute.  Variable definitions are executed before the data are passed, so x would actually exist when the compute is executed but would have no values.

    It's maybe easier to understand if you think about what you would have to write if the right hand side variable was a string.