banner



Spss How To Create A New Variable

Sometimes you may need to compute a new variable based on existing information (from other variables) in your data. For example, you may want to:

  • Convert the units of a variable from feet to meters
  • Use a subject's height and weight to compute their BMI
  • Compute a subscale score from items on a survey
  • Apply a computation conditionally, so that a new variable is only computed for cases where certain conditions are met

In this tutorial, we'll discuss how to compute variables in SPSS using numeric expressions, built-in functions, and conditional logic.

To compute a new variable, clickTransform> Compute Variable.

The Compute Variable window will open where you will specify how to calculate your new variable.

Compute Variable dialog window (SPSS version 25) with labels. A = Target Variable box, B = variable list, C = Numeric Expression box, D = numeric keypad

A Target Variable: The name of the new variable that will be created during the computation. Simply type a name for the new variable in the text field. Once a variable is entered here, you can click on "Type & Label" to assign a variable type and give it a label. The default type for new variables is numeric.

B The left column lists all of the variables in your dataset. You can use this menu to add variables into a computation: either double-click on a variable to add it to the Numeric Expression field, or select the variable(s) that will be used in your computation and click the arrow to move them to the Numeric Expression text field (C).

C Numeric Expression: Specify how to compute the new variable by writing a numeric expression. This expression must include one or more variables from your dataset, and can use arithmetic or functions.

When writing an expression in the Compute Variables dialog window:

  • SPSS is not case-sensitive with respect to variable names.
  • When specifying the formula for a new variable, you have to option to include or not include spaces after the commas that go between arguments in a function.
  • Do not put a period at the end of the expression you enter into the Numeric Expression box.

D The center of the window includes a collection of arithmetic operators, Boolean operators, and numeric characters, which you can use to specify how your new variable will be calculated. There are many kinds of calculations you can specify by selecting a variable (or multiple variables) from the left column, moving them to the center text field, and using the blue buttons to specify values (e.g., "1") and operations (e.g., +, *, /).

E If:The If option allows you to specify the conditions under which your computation will be applied.

F Function group: You can also use the built-in functions in the Function group list on the right-hand side of the window. The function group contains many useful, common functions that may be used for calculating values for new variables (e.g., mean, logarithm). To find a specific function, simply click one of the function groups in the Function Group list. You will now see a list of functions that belong to that function group in the Functions and Special Variables area. If you click on a specific function, a description of that function will appear in the text field to the left.


ClickIf (indicated by letter E in the above image) to open the Compute Variable: If Cases window.

Compute Variable If Cases dialog window (SPSS version 25).

1The left column displays all of the variables in your dataset. You will use one or more variables to define the conditions under which your computation should be applied to the data.

2 The default specification is to Include all cases. To specify the conditions under which your computation should be applied, however, you will need to click Include if case satisfies condition. This will allow you to specify the conditions under which the computation will be applied to your data.

3The center of the dialog box includes a collection of arithmetic operators, Boolean operators, and numeric characters, which you can use to specify the conditions under which your recode will be applied to the data. There are many kinds of conditions you can specify by selecting a variable (or multiple variables) from the left column, moving them to the center text field, and using the blue buttons to specify values (e.g., "1") and operations (e.g., +, *, /). You can also use the built-in functions in the Function Group list under the right column.

After you are finished defining the conditions under which your computation will be applied to the data, clickContinue. Note that when you specify a condition in the Compute Variable: If Cases window, the computation will only be performed on the cases meeting the specified condition. If a case does not meet that condition, it will be assigned a missing value for the new variable.

Spss How To Create A New Variable

Source: https://libguides.library.kent.edu/spss/computevariables

Posted by: houckearon1950.blogspot.com

0 Response to "Spss How To Create A New Variable"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel