In this activity we will look at height and weight data that were collected from 57 males and 24 females, and use the data to explore how the weight of a person is related to (or affected by) his or her height. This implies that height will be our explanatory variable and weight will be our response variable. We will then look at gender, and see how labeling this third variable contributes to our understanding of the form of the relationship.

Our dataset contains the following variables:

  • gender: 0 = male, 1 = female.
  • height: in inches.
  • weight: in pounds.

Though, we will provide SAS and SPSS output in the question below, we encourage you to create this output yourself using the datasets height.xls or height.csv.

To create the reuiqred output in SPSS:

  • Import Data: FILE > OPEN > DATA, choose Excel file from the pull-down, find the file, continue
  • Define Variable Properties: Provide labels for 0 and 1 as Male and Female, and label
    • Height: label as “Height (inches)
    • Weight: label as “Weight (pounds)
  • Scatterplots: GRAPHS > CHART BUILDER, complete the wizard for each of the two requested graphs. Edit colors for males and females on the labeled scatterplot.

To create the required output in SAS:

  • Create FORMATS for Gender: Use PROC FORMAT to create a format to translate 1 into “Female” and 0 into “Male” (we will associate it with the variable in the next step).
  • Label and Format Variables: Using a DATA step, create a new dataset named height2 where you label the variables height and weight as Height (inches) and Weight (pounds) using a LABEL statement. Use a format statement to format the variable gender with the format created in the previous step.
  • View Dataset Information in SAS: Use PROC CONTENTS to view the information about the new dataset.
  • Create Basic Scatterplot: Use PROC SGPLOT and the SCATTER statement to create a scatterplot of X=height by Y=weight
  • Create Labeled Scatterplot: Use PROC SGPLOT and the SCATTER statement to create a scatterplot of X=height by Y=weight with the GROUP= option to label the points by gender.

Learn By Doing
Question prompt


A Choice 1
B Choice 2
C Choice 3
D Choice D
E Choice E
F Choice F
G Choice G
H Choice H
Our Answer Comments.