-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathADAE_Freq_of_Max_Grade1_AE_by_SOC.sas
99 lines (86 loc) · 4.03 KB
/
ADAE_Freq_of_Max_Grade1_AE_by_SOC.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/****************************************************************************************
Program: Program 2-1.sas
SAS Version: SAS 9.4M3
Developer: Yuchuan Han
Date: 16NOV23
Purpose: Create Frequency Plot of Maximum Grade 1 AE for each SOC – Low-Dose Xanomeline
outputs for SAS® Graphics for Clinical Trials by Example book.
Operating Sys: Windows 7
Macros: NONE
Input: adam.adsl, tfldata.adaesummary1, tfldata.format_dataset_output_2_1
Output: Output 2-1.png
Comments: Use CustomSapphire style that was provided by SAS press
Note CustomSapphire is not provided with SAS but rather created
specifically for SAS Press books
-----------------------------------------------------------------------------------------
****************************************************************************************/
/*******************************************/
/*** BEGIN SECTION TO BE UPDATED BY USER ***/
/*******************************************/
*Including Custom Sapphire Style;
%include "\Users\hannah\Documents\SAS-Graphs\CustomSapphire.sas";
libname adam "\Users\hannah\Documents\SAS-Graphs\sasdatasets\adam";
libname tfldata "\Users\hannah\Documents\SAS-Graphs\sasdatasets\tfldata";
%let outputpath = \Users\hannah\Documents\SAS-Graphs\AE\output;
/*****************************************/
/*** END SECTION TO BE UPDATED BY USER ***/
/*****************************************/
/* Visualising AE data */
/* Summary of Treatment-Emergent Adverse Events by Maximum CTCAE Grade */
data adsl;
set adam.adsl;
where saffl = "Y";
run;
/* Calculating Total number of subjects in treatment group */
proc sql;
create table pop_calcs as
select trt01an as trtan, trt01a as trta, count(distinct usubjid) as n
from adsl
group by TRT01AN;
quit;
/* Obtaining N number for patients treated with Xanomeline Low Dose */
proc sql;
select distinct N into: trt2N
from pop_calcs
where TRTAN = 54;
quit;
%let trt2N = %sysfunc(strip(&trt2N));
* Using format;
proc format cntlin = tfldata.format_dataset_output_2_1;
run;
proc template;
define style styles.aepanelstyle;
parent = customsapphire;
style GraphFonts from GraphFonts /
'GraphValueFont' = ("<sans-serif>, <MTsans-serif>",5pt)
'GraphLabelFont'=("<sans-serif>, <MTsans-serif>",6pt)
'GraphDataFont'=("<sans-serif>, <MTsans-serif>",5pt)
'GraphTitleFont' = ("<sans-serif>, <MTsans-serif>, sans-serif",7pt, bold);
end;
run;
proc template;
define statgraph aedatapanelsoc;
mvar trt2n;
dynamic _byval_;
begingraph;
entrytitle "Actual Treatment = " _byval_ ", N = " trt2n;
entryfootnote halign=left "Note: The numbers on top of the bars are count of patients and not percentages" / textattrs=(size=6pt);
layout datapanel classvars = (order) / columns = 2 rows = 1 columndatarange = union
headerlabelattrs = (size = 4px) headerlabeldisplay = value
columnaxisopts = (label = "Total and MedDRA Preferred Term" type = discrete)
cellwidthmin=45px cellheightmin=45px;
layout prototype;
barchart x = adecod y = Percentage / barwidth = 0.8;
scatterplot x = adecod y = ylabel / markercharacter = countn;
endlayout;
endlayout;
endgraph;
end;
run;
ods listing gpath = "&outputpath" image_dpi = 300 style = aepanelstyle;
ods graphics / reset = all imagename = "Output 2-1" imagefmt = png height = 3.33in width = 5in;
proc sgrender data = tfldata.adaesummary1 template = aedatapanelsoc;
where trtan = 54 and aesoc in ("GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS", "SKIN AND SUBCUTANEOUS TISSUE DISORDERS"); * The AESOC condition only outputs the first two SOCs;
by trta;
format order aefmt.;
run;