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…

# Category: SASpphire 蓝宝石

## SDTM LB2

SDTM Day 3 : LB, Laboratory Dataset Last Time we introduced SDTM.LB for laboratory Test Results in Finding General Observation Class and Showed an example of how to merge with SV(Subject Visit) to get Epoch. SDTM.LB is one of the most crucial datasets for Drug Safety Analysis, it could be challenging due to the vast amount of records. This…

## 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…

## SDTM QS

SDTM Day 2: QS Background: As the novice treatments for Cancer therapy have been developed, not only we care about prolonging the lives of patients, scientists also put their endeavor to improve the life qualities. SDTM.QS is designed for capturing the patients’ questions info. Definition: QS domain is a questionaries domain that contains a variety of patient information about different questionnaires. Such…

## 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…

## SAS Proc Import

SAS Day 13: Proc Import In clinical trials, we often have Special Interest Excel Sheet from Medical Writer that we need to use Proc Import to convert excel or csv data format into SAS dataset. There were times I can convert the file smoothly, there were other times I ran into all kinds of problems while converting the excel…

## SAS Proc Sort

SAS Day 12: Proc Sort We use Proc Sort to organize our data before presenting our final output such as plot the Waterfall graph or Merge with another dataset. Basic Syntax: Proc Sort data=a out=b; by variable1; run; I have 6 favorite ❤ options in Proc Sort: By, Where, Nodupkey, Descending, Out, Dupout. Example: sashelp.cars data car; set sashelp.cars; run; By:…

## SAS Coalescec

SAS Day 11: COALESCEC Problem: We want to select the non-missing value among qs1 to qs5 as QSSTRESN. Desired Output: SAS Function Background: COALESECEC: Return the first non-missing Character String among the input variables Syntax: Coalescec(” “, “a ” )=a Solution: qsorres= strip(coalescec(qsorres1,qsorres2,qsorres3,qsorres4,qsorres5)); Alternative Solution: Using Array array values {*} $200 QS1 QS2 QS3 QS4 QS5; do i =1 to dim(values); if values{i} ne “” then QSORRES=strip(values{i}); end;…