Category: SAS

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…

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

SAS Bonferroni Method

SAS Day 10: Bonferroni Method   Background: We know ANOVA is good for testing if there is any difference between the mean value among different groups. Null Hypothesis: If the p-value for ANOVA <0.05, we know there is at least one group have different mean values compared to others.However, we do not know which groups have significant mean values.  If we…

SAS ARRAY 1

SAS DAY 9: ARRAY Problem: We want to assign values for QSSTRESN such that it matches with the variable QSTESTCD. (E.g. QSTESTCD=”EQ5D01″, QSTRESN=QS1) Desired Output: USUBJID QSTESTCD QS1 QS2 QS3 QS4 QS5 QSSTRESN TF001 EQ5D01 1 1 1 1 1 1 TF001 EQ5D02 1 1 2 1 1 1 TF001 EQ5D03 1 1 3 1 2 3 TF001 EQ5D04 1 2…

Social media & sharing icons powered by UltimatelySocial