[go: up one dir, main page]

0% found this document useful (0 votes)
9 views15 pages

SAS Arrays for Longitudinal Data Analysis

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views15 pages

SAS Arrays for Longitudinal Data Analysis

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Advanced Data Science Using

SAS
Day 10 – Sun, 10 Dec 2024
Lal Bahadur Shastri Institute of
Management
G Krishnamurthy
Programing Constructs In SAS –
Using Arrays
Topics
• Recap
– Multiple Observations Per Subject
• Working With Arrays
– What is an Array
– Types of Arrays
– Performing An Operation on Every Variable
– Conversions From One Observation To Many Observations
– Conversions From Many Observation To One Observation
• Exercises
Recap
Working with Multiple
Observations in SAS
Introduction
• SAS normally processes one observation at a time
• However, in medical trials, longitudinal data
needs to be processes, that is, taking recordings
of people at different points of time
• SAS data sets for medical trials have time-based
monitoring of medical parameters
• Here, we discuss how SAS handles this kind of
data
Tools To Work with Longitudinal Data
• There are three types of programming tools
– LAG and DIF
• Using DIF to see the difference between FIRST and LAST
– First and Last variables
• Using SET-BY, followed by PUT
– Retained variables
• Used to compute the difference between first and last
record
Recap Exercises
• Please write the code to identify the purpose
of the lag function
• Consider the given program Exercise 2
– I have written a program, Exercise 2B
– Please explain why Exercise 2B is not working
Working With Arrays
Definition of Arrays
Need For Arrays
• A SAS array is nothing but a collection of SAS variables
• Using the array name and a subscript, an array element can
be used to represent any variable included in the array
• Arrays are created using ARRAY
• Array names are the same as variable names, along with a
bracket.
• You can use (), {}, or [] in defining an array name.
• Miss[1] represents the first variable in an array
• Consider a non-array program, Program 1, and we will
convert it to an array
Describing Numeric Arrays
• In the program, we use a DO-END loop to
process the data
– If Miss[i] = 999 then Miss[i] = .;
Describing Character Arrays
• Character arrays are created in the same
manner as numeric arrays
• We are using character arrays in Program 3 to
convert all values into upper case
• Please try this out for the SASHELP data set,
BASEBALL
Conversions – One Observation To Multiple
Observations
• Write a program to create a dataset wide that
lists one observation record for each subject
– Being done in Program 6
• Now, we need to convert this to a dataset that
has five observation records for each subject
– Being done in Program 7
• The reverse procedure has been done in
Program 8
Thank You

You might also like