Lesson 26: Working with Date and Longitudinal Data

Overview Section

In this lesson, we return to a number of topics that we already learned about in Part II of this course. Such topics include handling date variables, selecting first and/or last observations, and using the MEANS and SUMMARY procedures to calculate summary statistics. Here, however, our focus will be on using the techniques to analyze longitudinal data, that is, data that are collected over time.

Objectives

Upon completion of this lesson, you should be able to:

Upon completing this lesson, you should be able to do the following:

  • read date values into SAS using appropriate informats
  • tell SAS to display your date values using appropriate formats
  • use dates to calculate new values
  • use the YRDIF function to calculate age
  • understand how longitudinal data can be stored in one observation
  • understand how longitudinal data can be stored in multiple observations
  • use the FIRST.variable and LAST.variable to identify first and last observations, respectively
  • use the LAG function to return the value of a variable from the previous observation
  • use the DIF function to calculate the difference between a variable's value in the current observation and the variable's value in the previous observation
  • use the RETAIN statement and the FIRST.variable and LAST.variable to calculate the difference between the first and last observation for each subject
  • use the FIRST.variable and/or LAST.variable, in conjunction with the FREQ procedure, to compute frequencies on longitudinal data sets
  • create summary data sets using the MEANS or SUMMARY procedure

Textbook Reference Section

 Chapter 4 of the textbook.