SAS Day 19: Format Background: In clinical datasets, we usually use some shortcode to keep the data to be concise, meanwhile, we want to generate detailed table labels from the datasets so the output is reader-friendly. For example, in the dataset, we have “F, M“, and we want to show “Female, Male” in output tables.

# Category: SAS

## SAS Baseline

SAS Day 21: Baseline Value Background: How do we decide if the Weight Loss program/drug is effective or the laser operation improves the vision? Usually, we compare the weights before and after a program or track the vision before and after the eye laser surgery. The Change From Baseline is a critical measurement of efficacy analysis. Therefore, it is very crucial to record the…

## SAS Miss function

SAS Day 20: Miss function There are two miss functions in SAS I really like, NMISS and CMISS. Problem: if we want to calculate the duration as aendt(Adverse Event End Date) – aestdt (Adverse Event Start Date). Ideally, we can use adurn=aendt-aestdt +1. However, in reality, we know there are high probabilities with missing AE dates.

## SAS LOCF

SAS Day 18: LOCF Background: Clinical trial studies often spanned several years. What happens if patients did not participate the check such as Vital Sign(blood pressure, weight) or Lab value(white blood cell count, red blood cell count) on some of the time points and caused the missing data? The pharmaceutical industry standard method for imputing missing data is LOCF (Last Observation…

## SAS Proc Phreg

SAS day 17: Proc Phreg One day, my boss took a glance at a table with Hazard Ratio and Median Survival Time then he told me the program set the reference group in Proc Phreg flipped. It turns out he was correct after validating the program. However, I was very curious about how did he figure it out by an…

## SAS 11.11

In China, 11.11 is Single’s Day. I found this day very interesting, although 1111 looks like a solitude date on the calendar. It is not! It has a prime factorization 1111=101*11, and both 11 and 101 are primes. Therefore I think 1111 is a cute number and a Prime relationship day! Some people may be like Composite Numbers, always have…

## SAS Proc SQL 1

SAS Day 16: Proc SQL 1 Case When Problem: Suppose we need to merge the SDTM.VS (Vital Sign) dataset with SDTM.SE (Subject Element) for Epoch Infomation. We will assign the EPOCH to VS if the VSDY is between SESTDY and SEENDY. Example: Usubjid=TF-001-001-001, VISIT=SCREENING, VSDY=-6, EPOCH=SCREENING Background: SAS Merge is perfect for 1 to 1 merge or many to 1…

## SAS Proc Compare

SAS Day 15: Proc Compare Problem: Suppose we need to compare the dataset Prod and QC. Background: We use Proc Compare to compare the value of two datasets. The report will give us the summary of two dataset. Proc compare has many options, the ones I like the most are: Criterion, Var…. With, Listall, Id, Out. Criterion: Set…

## CMH Test

Data Science Day 11: CMH Test We know Chi-square can test the independence between two categorical variables in one sample population. What if we need to check the independence relation among three categorical variables or more? Cochran Mantel Haenszel (CMH): There are 3 categorical variables, we want to test if the third categorical variable is independent of the other two variables. Usually, the third nominal…

## SAS Index

SAS Day 14: INDEX/INDEXC Problem: We want to select all the MedDRA_PT contains “Acute leukemia”. such as Acute leukemia, Acute leukemia in remission. Background of INDEX function: INDEX function searches a character expression for a string of characters, and it returns the position of the string’s first character for the first occurrence of the string. While theoretically, we use…