INPUT | FORMAT | PROC SORT | MERGE | BY | IF | PROC FREQ | TABLES | TITLE | ODS | PROC REPORT | CALL DEFINE | ODS LISTING | PROC COMPARE CHALLENGE
/*CHALLENGE*/
/*1.Merge SDTM.DM and SDTM.AE to create a subject-level listing.*/
/*2.Summarize adverse events by severity and treatment (PROC FREQ).*/
/*3.Create a formatted TLF output (PROC REPORT, ODS PDF).*/
/*4.Validate using PROC COMPARE.*/
DATA SDTM_DM;
INPUT USUBJID $ AGE SEX $ ARM $;
DATALINES;
101 45 M Placebo
102 36 F DrugA
103 50 M DrugB
104 48 F Placebo
;
RUN;
PROC PRINT;RUN;
OUTPUT:
| 101 |
45 |
M |
Placebo |
| 102 |
36 |
F |
DrugA |
| 103 |
50 |
M |
DrugB |
| 104 |
48 |
F |
Placebo |
DATA SDTM_AE;
INPUT USUBJID $ AEDECOD $ AESEV $ AESER $ AESTDTC : yymmdd10.;
FORMAT AESTDTC DATE9.;
DATALINES;
101 HEADACHE MILD N 2024-01-05
102 NAUSEA SEVERE Y 2024-01-06
103 VOMITING MODERATE N 2024-01-07
104 FATIGUE MILD N 2024-01-08
;
RUN;
PROC PRINT;RUN;
OUTPUT:
| 101 |
HEADACHE |
MILD |
N |
05JAN2024 |
| 102 |
NAUSEA |
SEVERE |
Y |
06JAN2024 |
| 103 |
VOMITING |
MODERATE |
N |
07JAN2024 |
| 104 |
FATIGUE |
MILD |
N |
08JAN2024 |
PROC SORT DATA=SDTM_DM OUT=DM_SORT;BY USUBJID;RUN;
PROC SORT DATA=SDTM_AE OUT=AE_SORT;BY USUBJID;RUN;
/*1.Merge SDTM.DM and SDTM.AE to create a subject-level listing.*/
DATA DMAE;
MERGE DM_SORT (IN=A)
AE_SORT (IN=B);
BY USUBJID;
IF A AND B;
RUN;
PROC PRINT;RUN;
OUTPUT:
| 101 |
45 |
M |
Placebo |
HEADACHE |
MILD |
N |
05JAN2024 |
| 102 |
36 |
F |
DrugA |
NAUSEA |
SEVERE |
Y |
06JAN2024 |
| 103 |
50 |
M |
DrugB |
VOMITING |
MODERATE |
N |
07JAN2024 |
| 104 |
48 |
F |
Placebo |
FATIGUE |
MILD |
N |
08JAN2024 |
PROC FREQ DATA=DMAE;
TABLES ARM*AESEV / MISSING NOROW NOPERCENT NOCOL;
TITLE "Summary Adverse Events By Severity And Treatment";
RUN;
TITLE;
OUTPUT:
The FREQ Procedure
ODS PDF FILE = "C:\Users\Desktop\PDF\DMAE.PDF" STYLE=JOURNAL;
PROC REPORT DATA=DMAE NOWD;
COLUMN USUBJID AGE SEX ARM AEDECOD AESEV AESER AESTDTC;
DEFINE USUBJID / 'SUBJECT ID' ORDER;
DEFINE AGE / 'AGE' DISPLAY;
DEFINE SEX / 'SEX' DISPLAY;
DEFINE AEDECOD / 'ADVERSE EVENT' DISPLAY;
DEFINE ARM / 'TREATMENT GROUP' DISPLAY;
DEFINE AESEV / 'SEVERITY' DISPLAY;
DEFINE AESER / 'SERIOUS AE' DISPLAY;
DEFINE AESTDTC / 'START DATE' DISPLAY FORMAT=DATE9.;
COMPUTE AESER;
IF AESER = 'Y' THEN CALL DEFINE(_ROW_ , "STYLE" , "STYLE=[FOREGROUND=RED]");
ENDCOMP;
RUN;
ODS _ALL_ CLOSE;
PROC PRINT;RUN;
OUTPUT:
| 101 |
45 |
M |
Placebo |
HEADACHE |
MILD |
N |
05JAN2024 |
| 102 |
36 |
F |
DrugA |
NAUSEA |
SEVERE |
Y |
06JAN2024 |
| 103 |
50 |
M |
DrugB |
VOMITING |
MODERATE |
N |
07JAN2024 |
| 104 |
48 |
F |
Placebo |
FATIGUE |
MILD |
N |
08JAN2024 |
ODS LISTING;
PROC COMPARE BASE=SDTM_DM COMPARE=DMAE;
BY USUBJID;
TITLE "VALIDATION OF MERGED DATA";
RUN;
TITLE;
ODS LISTING CLOSE;
OTUPUT:
VALIDATION OF MERGED DATA 12
00:00 Monday, September 14, 2015
The COMPARE Procedure
Comparison of WORK.SDTM_DM with WORK.DMAE
(Method=EXACT)
Data Set Summary
Dataset Created Modified NVar NObs
WORK.SDTM_DM 14SEP15:05:26:36 14SEP15:05:26:36 4 4
WORK.DMAE 14SEP15:05:28:21 14SEP15:05:28:21 8 4
Variables Summary
Number of Variables in Common: 4.
Number of Variables in WORK.DMAE but not in WORK.SDTM_DM: 4.
Number of BY Variables: 1.
VALIDATION OF MERGED DATA 13
00:00 Monday, September 14, 2015
The COMPARE Procedure
Comparison of WORK.SDTM_DM with WORK.DMAE
(Method=EXACT)
-------------------------------------------- USUBJID=101 ---------------------------------------------
Observation Summary
Observation Base Compare
First Obs 1 1
Last Obs 1 1
Number of Observations in Common: 1.
Total Number of Observations Read from WORK.SDTM_DM: 1.
Total Number of Observations Read from WORK.DMAE: 1.
Number of Observations with Some Compared Variables Unequal: 0.
Number of Observations with All Compared Variables Equal: 1.
NOTE: No unequal values were found. All values compared are exactly equal.
00:00 Monday, September 14, 2015
The COMPARE Procedure
Comparison of WORK.SDTM_DM with WORK.DMAE
(Method=EXACT)
-------------------------------------------- USUBJID=102 ---------------------------------------------
Observation Summary
Observation Base Compare
First Obs 2 2
Last Obs 2 2
Number of Observations in Common: 1.
Total Number of Observations Read from WORK.SDTM_DM: 1.
Total Number of Observations Read from WORK.DMAE: 1.
Number of Observations with Some Compared Variables Unequal: 0.
Number of Observations with All Compared Variables Equal: 1.
NOTE: No unequal values were found. All values compared are exactly equal.
VALIDATION OF MERGED DATA 15
00:00 Monday, September 14, 2015
The COMPARE Procedure
Comparison of WORK.SDTM_DM with WORK.DMAE
(Method=EXACT)
-------------------------------------------- USUBJID=103 ---------------------------------------------
Observation Summary
Observation Base Compare
First Obs 3 3
Last Obs 3 3
Number of Observations in Common: 1.
Total Number of Observations Read from WORK.SDTM_DM: 1.
Total Number of Observations Read from WORK.DMAE: 1.
Number of Observations with Some Compared Variables Unequal: 0.
Number of Observations with All Compared Variables Equal: 1.
NOTE: No unequal values were found. All values compared are exactly equal.
00:00 Monday, September 14, 2015
The COMPARE Procedure
Comparison of WORK.SDTM_DM with WORK.DMAE
(Method=EXACT)
-------------------------------------------- USUBJID=104 ---------------------------------------------
Observation Summary
Observation Base Compare
First Obs 4 4
Last Obs 4 4
Number of Observations in Common: 1.
Total Number of Observations Read from WORK.SDTM_DM: 1.
Total Number of Observations Read from WORK.DMAE: 1.
Number of Observations with Some Compared Variables Unequal: 0.
Number of Observations with All Compared Variables Equal: 1.
NOTE: No unequal values were found. All values compared are exactly equal.
PRACTICE AND COMMENT YOUR CODE:
-->PLEASE FOLLOW OUR BLOG FOR MORE UPDATES.
No comments:
Post a Comment