User Tools

Site Tools


sascode
data test;
  informat start_date end_date baseline_date anydtdte10.;
  format start_date end_date baseline_date date9.; 
  label No_='Subject';
  input No_	$ Start_date	End_date	Baseline_date	Drug $	Severity $	line_end	start1	end1	start2	end2	start3	end3	low	Duration $;
  datalines;
101	2016/8/26	2016/9/3	2016/8/19	A	Moderate	3.1	.	.	2	3.1	.	.	0	Duration
102	2016/8/31	2016/9/13	2016/8/19	B	Mild	    4.6	2.7	4.6	.	.	.	.	0	Duration
103	2016/8/26	2016/9/16	2016/8/19	A	Mild	    5	2	5	.	.	.	.	0	Duration
103A	2016/8/31	2016/8/31	2016/8/19	A	Severe	    2.7	.	.	.	.	2.7	2.7	0	Duration
103B	2016/8/25	2016/8/30	2016/8/19	A	Severe	    3.1	.	.	.	.	1.9	2.6	0	Duration
106	2016/8/31	2016/9/2	2016/8/19	A	Severe	    3.1	.	.	.	.	2.7	3	0	Duration
107	2016/9/3	2016/9/3	2016/8/19	A	Severe	    3.1	.	.	.	.	3.1	3.1	0	Duration
108	2016/8/21	2016/8/26	2016/8/19	A	Moderate	3.9	.	.	1.3	2	.	.	0	Duration
109	2016/9/3	2016/9/8	2016/8/19	A	Moderate	3.9	.	.	3.1	3.9	.	.	0	Duration
110	2016/8/30	2016/10/13	2016/8/19	C	Moderate	8.9	.	.	2.6	8.9	.	.	0	Duration
111	2016/9/12	2016/9/12	2016/8/19	B	Mild	    4.7	4.4	4.4	.	.	.	.	0	Duration
112	2016/9/14	2016/9/14	2016/8/19	B	Mild	    4.7	4.7	4.7	.	.	.	.	0	Duration
113	2016/8/30	2016/9/3	2016/8/19	C	Severe	    3.1	.	.	.	.	2.6	3.1	0	Duration
113A	2016/9/5	2016/9/26	2016/8/19	B	Mild	    6.4	3.4	6.4	.	.	.	.	0	Duration
113B	2016/8/28	2016/9/6	2016/8/19	A	Severe	    3.6	.	.	.	.	2.3	3.6	0	Duration
116	2016/8/29	2016/9/30	2016/8/19	A	Mild	    7	2.4	7	.	.	.	.	0	Duration
117	2016/8/31	2016/9/9	2016/8/19	A	Moderate	4	.	.	2.7	4	.	.	0	Duration
118	2016/8/19	2016/9/1	2016/8/19	A	Mild	    2.9	1	2.9	.	.	.	.	0	Duration
119	2016/9/6	2016/10/13	2016/8/19	A	Moderate	8.9	.	.	3.6	8.9	.	.	0	Duration
120	2016/8/29	2016/9/2	2016/8/19	A	Moderate	8.9	.	.	2.4	3	.	.	0	Duration
121	2016/9/1	2016/10/8	2016/8/19	A	Mild	    8.1	2.9	8.1	.	.	.	.	0	Duration
122	2016/8/29	2016/9/3	2016/8/19	B	Moderate	3.1	.	.	2.4	3.1	.	.	0	Duration
123	2016/9/1	2016/9/7	2016/8/19	A	Moderate	3.7	.	.	2.9	3.7	.	.	0	Duration
124	2016/8/30	2016/9/2	2016/8/19	B	Severe	    3	.	.	.	.	2.6	3	0	Duration
125	2016/8/30	2016/9/6	2016/8/19	A	Moderate	3.6	.	.	2.6	3.6	.	.	0	Duration
126	2016/8/30	2016/8/30	2016/8/19	B	Mild	    3.1	2.6	2.6	.	.	.	.	0	Duration
127	2016/8/31	2016/9/3	2016/8/19	B	Mild	    3.1	2.7	3.1	.	.	.	.	0	Duration
128	2016/9/6	2016/9/8	2016/8/19	B	Moderate	3.9	.	.	3.6	3.9	.	.	0	Duration
129	2016/8/19	2016/9/2	2016/8/19	B	Moderate	3.9	.	.	1	3	.	.	0	Duration
130	2016/8/29	2016/10/14	2016/8/19	B	Moderate	9	.	.	2.4	9	.	.	0	Duration
131	2016/9/4	2016/9/3	2016/8/19	B	Severe	    3.1	.	.	.	.	3.3	3.1	0	Duration
132	2016/8/29	2016/9/4	2016/8/19	A	Moderate	3.3	.	.	2.4	3.3	.	.	0	Duration
;
run;

/*proc print;run;*/

ods listing gpath='C:\Work\SASUser\Communities\Image' image_dpi=200;
ods graphics / reset imagename='Swimmer';
title h=1 'Figure 1 : Summary Horizontal Bar Chart of Severity'; 
proc sgplot data=test nocycleattrs;
highlow y=No_ low=low high=line_end / group=drug attrid=A type=bar fill nooutline transparency=0.5
        name='drug';
highlow y=No_ low=start1 high=end1 / group=Duration lineattrs=(thickness=2 pattern=solid)
  		lineattrs=(color=red) name='Duration' nomissinggroup attrid=Duration;
highlow y=No_ low=start2 high=end2 / group=Duration lineattrs=(thickness=2 pattern=solid)
  		lineattrs=(color=blue) name='Duration' nomissinggroup attrid=Duration;
highlow y=No_ low=start3 high=end3 / group=Duration lineattrs=(thickness=2 pattern=solid)
  		lineattrs=(color=black) name='Duration' nomissinggroup attrid=Duration;
 scatter X=start1 Y=No_ /markerattrs=(symbol=trianglefilled size=8 color=red) name='a' legendlabel='Mild Start';
 scatter X=end1 Y=No_ /markerattrs=(symbol=circlefilled size=8 color=red)  name='b' legendlabel='Mild End';
 scatter X=start2 Y=No_ /markerattrs=(symbol=trianglefilled size=8 color=blue) name='c' legendlabel='Moderate Start';
 scatter X=end2 Y=No_ /markerattrs=(symbol=circlefilled size=8 color=blue)  name='d' legendlabel='Moderate End';
 scatter X=start3 Y=No_ /markerattrs=(symbol=trianglefilled size=8 color=black) name='e' legendlabel='Severe Start';
 scatter X=end3 Y=No_ /markerattrs=(symbol=circlefilled size=8 color=black)  name='f' legendlabel='Severe End';
 yaxis type=discrete display=(noticks) fitpolicy=none labelpos=top;
 xaxis type=linear label="Week" values=(0 to 12 by 1);
 keylegend 'drug' / title='Treatment Group';
 keylegend 'a' 'b' 'c' 'd' 'e' 'f'/ noborder location=inside position=bottomright across=1;
run;	
sascode.txt · Last modified: 2022/11/20 02:16 by 216.244.66.228