6   Using PROC SQL with Longitudinal Data

Introduction

Creating a Demonstration Data Set

A Simple SQL Query

Using PROC SQL to Count Observations within a BY Group

Demonstrating a HAVING Clause

Using PROC SQL to Create a Macro Variable

Using a Summary Function to Compute Group Means

Introduction

A SAS procedure called PROC SQL (which stands for Structured Query Language and is pronounced “sea quell” or spelled out as S-Q-L ) provides you with an alternative or addition to DATA step programming. There are several applications of SQL to longitudinal data where one SQL query can replace several DATA steps.  SQL is especially useful when you want to combine summary information (such as a count of the number of observations for each subject) with the ...

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.