I'm attempting to create a SAS macro that will generate a shift table for laboratory values. I have the following data:
Study Subject Lab Measure Range Group Visit
Study1 001 Lab1 45 Normal 1 Baseline
Study1 001 Lab1 50 High 1 Visit2
Study1 001 Lab1 55 High 1 Visit3
Study1 002 Lab1 40 Normal 1 Baseline
Study1 002 Lab1 44 Normal 1 Visit1
Study1 002 Lab1 45 Normal 1 Visit2
Study1 002 Lab1 46 Normal 1 Visit3
Study1 002 Lab1 52 High 1 Visit4
I'd like to create the following output:
Final Lab Value
Parameter Group Baseline Value Low Normal High Missing
Lab1 Study 1 Group 1 (N = 2)
LOW 0 0 0 0
NORMAL 0 0 2 (100) 0
HIGH 0 0 0 0
LOW or NORMAL (N = 2) 0 0 2 (100) 0
HIGH or NORMAL (N = 2) 0 0 2 (100) 0
So far I've been able to create a basic shift table, but I would like to expand this to a 'by study' macro.
Here is the output for two or more studies.
Final Lab Value
Parameter Group Baseline Value Low Normal High Missing
Lab1 Study 1 Group 1 (N = 2)
LOW 0 0 0 0
NORMAL 0 0 2 (100) 0
HIGH 0 0 0 0
LOW or NORMAL (N = 2) 0 0 2 (100) 0
HIGH or NORMAL (N = 2) 0 0 2 (100) 0
Low Normal High Missing
Study 1 Group 2 (N = 8)
LOW 0 0 0 0
NORMAL 0 0 8 (100) 0
HIGH 0 0 0 0
LOW or NORMAL (N = 8) 0 0 8 (100) 0
HIGH or NORMAL (N = 8) 0 0 8 (100) 0
Low Normal High Missing
Study 2 Group 1 (N = 8)
LOW 0 0 0 0
NORMAL 0 0 8 (100) 0
HIGH 0 0 0 0
LOW or NORMAL (N = 8) 0 0 8 (100) 0
HIGH or NORMAL (N = 8) 0 0 8 (100) 0