Advance Biostats SPSS Assignment: Multiple Logistic Regression in Action

vwccspt12
W7A_7.1_PracticeStep-by-StepGuide.doc

PART1

Step-by-Step Guide to Assignment 7.1

Creating and Recoding Variables

Problem 1. Variables and variable selection

a. Use a table to list the variables, Sex, Age in Years, Serum Cholesterol, Obese, and Hypertension, and each of their levels of measurement.

Open “practice_week07_dataset.sav” in SPSS. In Variable View, locate the Measure column. This provides the level of data for each variable. There are three choices of levels in SPSS: nominal, ordinal, and scale.

image1.png

Create a table in MS Word. List the variables with the corresponding levels of measurement.

Variable

Level of Measurement

Values

Study ID number

Nominal

Sex

Nominal

1 = men, 2 = women

Age

Scale

Range 37 - 59

Serum cholesterol

Scale

Range 150 - 534

Obese

Nominal

0 = no, 1 = yes

Hypertension

Nominal

0= no, 1 = yes

Definitions for level of measurement obtained from “Values” column in Variable View:

Scale: Continuous, interval Nominal: dichotomous, categorical

b. Create new variables Age_Cat and Serum Chole_Cat:

· Age_Cat: Convert Age in Years into a categorical variable with 2 categories, Less than 40, 40 and greater

Before creating a new variable, identify the range of ages in the data set. Note: At any point in the following, if you decide to close out SPSS, be sure to save the changes you made before exiting the program or they will not be there when to re-open your data set!

Step 1. Find age range of your data set. In SPSS Data View, find “age” and right click on the variable name. Select Sort Ascending.

image2.png

Step 2. Note the lowest age value (32).

image3.png

Step 3. Scroll to the bottom (or re-sort to descending order by right-clicking again on “age” and selecting “Sort Descending”) and note the oldest age (59).

image4.png

The ages range between 32 and 59. The age categories are <40 and ≥40. The <40 category will thus contain ages 32-39. The ≥40 category will have ages 40-59.

Recoding the Age_Cat variable.

Step 4. To recode the continuous “age” variable into two categories, click on Transform and click Recode into Different Variables.

image5.png

Step 5. The following screen will appear. Select Age in Years [age] .

image6.png

Step 6. Click the right arrow; age (? will appear in the box now labeled Numeric Variable ( Output Variable.

image7.png

Step 7. On the right side of the screen Type Age_Cat in the Name box. Type Age Category in the Label box. Click on Old and New Variables.

image8.png

Step 8. Recode into Different Variables: Old and New Values window will appear. There are two sections: Old Value and New Value.

image9.png

Step 9. Under “Old Value”, select Range. Type 32 in the Range box and type 39 in box under “through”.

image10.png

Step 10. In the New Value section, select Value. Enter 1 in the box. Click Add.

image11.png

The newly assigned values will be placed in the Old - -> New area.

image12.png

Note: When “32 thru 39 ( 1” appears in the Old (New box, the numbers entered in Range and Value disappear.

Step 11. Return to Range under Old Values and type 40 in the box below Range and type 59 in the box below “through”. Enter 2 in the New Value box. Click “Add” to place the second set of ages in the Old - -> New area.

image13.png

Step 12. Both variable levels should now be in the Old ( New box. Click Continue.

image14.png

Step 13. In the Recode into Different Variables window, click Change then OK.

image15.png

Step 14. In the Data Editor screen, locate the new variable “Age_Cat” in Data View.

image16.png

Step 15. Note that the Age_Cat data include 2 decimals places. These are not necessary for nominal, categorical data. Switch to Variable View.

image17.png

Step 16. In Variable View, click on the cell at the intersection of the Age_Cat row and the “Decimal” column. Click on the down arrow to decrease decimal places to 0.

image18.png

Step 17. Click on “Values” cell for Age_Cat then click on the ellipsis.

image19.png

Step 18. The Value Labels screen will pop up. Type 1 in the Value box and type <40 in the Label box.

image20.png

Step 19. Click Add; 1 = “<40” will be displayed in the box next to Add.

Step 20. Enter 2 in the Value box and type >=40 in the Label box.

image21.png

Step 21. Click Add to move the values to the add box. Click OK.

image22.png

In Variable View, the Age_Cat variable information should be added.

image23.png

Step 21. Switch to Data View and check to make sure that all the data in the new Age_Cat column reflect the correct values in the “age” column. All ages 32-39 should be Age_Cat 1 and all the ages 40-59 should be Age_Cat 2. It helps if you have “age” sorted in ascending order.

image24.png

Recoding the Serum Chole_Cat variable.

· Serum Chole_Cat: Convert Serum Cholesterol into 3 categories, Under 200, 200-299, and 300 and greater

To create Serum Chole_Cat with 3 levels of data (Under 200, 200-299, and 300 and greater), follow the step above using the Serum Cholesterol [scl] variable.

Note that the scl data range from 150 to 534.

When the Recode into Different Variables screen opens, the Age_Cat information will be shown. To remove the previous entries for creating Age_Cat, click Reset.

image25.png

Step 1. Select Serum Cholesterol [scl] and transfer it to the Input Variable ( Output Variable box.

image26.png

Step 2. Enter Chole_Cat in the Name box and Cholesterol Category in the Label box.

image27.png

Level 1 will include 150-199 (150 was the lowest value), Level 2 will include values 200-299, and Level 3 will include values 300-534 (the highest value). Follow Steps 7 – 21 above, substituting these values for the three levels.

You should now have a categorical variable called Chole_Cat with scl data in 3 levels.

If you close out SPSS before proceeding to the next problem, remember to save your changes!