1   The RETAIN Statement

Introduction

Demonstrating a DATA Step with and without a RETAIN Statemen

Generating Sequential SUBJECT Numbers Using a Retained Variable

Using a SUM Statement to Create SUBJECT Numbers

Demonstrating That Variables Read with a SET Statement Are Retained

A Caution When Using a RETAIN Statement

Introduction

Suppose you have a SAS data set of clinical data. Each observation corresponds to a visit to the clinic and contains such information as a patient number, the date of the visit, and some information about the visit. It would be useful to compare information from one visit to another, for a given patient. How many days were there from the previous visit? Did this patient’s blood pressure go up or down? Questions such ...

Get Longitudinal Data and SAS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.