You want this ?
I have to leave now.
%let path= c:\temp ;
data have;
input study $ group : $20. value1 value2 sub_group $;
group2=scan(group,-1,'/');
cards;
study1 001/placebo 119 1 Allerg1
study1 001/placebo 115 8 Allerg2
study1 002/trt 112 4 Allerg1
study1 003/trt 112 2 Allerg1
study1 003/trt 112 6 Allerg2
study1 003/trt 110 2 Allerg3
study2 001/placebo 1129 . Allerg1
study2 001/placebo 1125 . Allerg2
study2 002/trt 1122 . Allerg1
study2 003/trt 1122 . Allerg1
study2 003/trt 1122 . Allerg2
study2 003/trt 1120 . Allerg3
;
proc format;
picture fmt
low-high='00009mg';
run;
options nodate nonumber orientation=portrait;
ods listing gpath="&path." style=htmlblue image_dpi=300;
ods graphics /width=3.5in height=6in reset=index noborder imagename='FAS' outputfmt=png ;
proc sgplot data=have(where=(study='study1')) noautolegend nocycleattrs pad=0px;
title "Study1";
format value1 value2 fmt.;
hbarparm category=group response=value1/group=sub_group fillpattern nofill groupdisplay=cluster datalabel=sub_group ;
hbarparm category=group response=value2/group=sub_group groupdisplay=cluster ;
xaxis display=(nolabel) values=(0 to 150 by 50) ;
yaxis display=(novalues nolabel) ;
yaxistable group2/location=outside position=left VALUEJUSTIFY=right valueattrs=(size=10) labelattrs=(color=white);
run;
ods graphics /width=3.5in height=6in reset=index noborder imagename='PPS' outputfmt=png;
proc sgplot data=have(where=(study='study2')) noautolegend nocycleattrs pad=0px;
title "Study2";
format value1 value2 fmt.;
hbarparm category=group response=value1/group=sub_group fillpattern nofill groupdisplay=cluster datalabel=sub_group ;
hbarparm category=group response=value2/group=sub_group groupdisplay=cluster ;
xaxis display=(nolabel ) values=(0 to 1200 by 300) ;
yaxis display=(novalues nolabel) ;
yaxistable group2/location=outside position=left VALUEJUSTIFY=right valueattrs=(size=10) labelattrs=(color=white);
run;
ods pdf file="&path.\want.pdf" style=minimal dpi=300 ;
data x;
x=' ';y=' ';output;
run;
title;
proc report data=x nowd noheader style={outputwidth=100% };
column x y;
define x/display style(column)={just=r};
define y/display style(column)={just=l};
compute y;
n+1;
if n=1 then do;
call define('x','style','style={ postimage="&path\FAS1.png" bordertopcolor=white borderbottomcolor=white borderrightcolor=white borderleftcolor=white}');
call define('y','style','style={ preimage="&path\PPS1.png" bordertopcolor=white borderbottomcolor=white borderrightcolor=white borderleftcolor=white}');
end;
endcomp;
run;
ods pdf close;
/*
You could try options:
fitpolicy= VALUESROTATE=
*/
data have;
input study $ group : $20. value1 value2 sub_group $;
group2=scan(group,-1,'/');
cards;
study1 001/placebo 119 1 Allerg1
study1 001/placebo 115 8 Allerg2
study1 002/trt 112 4 Allerg1
study1 003/trt 112 2 Allerg1
study1 003/trt 112 6 Allerg2
study1 003/trt 110 2 Allerg3
study2 001/placebo 1129 . Allerg1
study2 001/placebo 1125 . Allerg2
study2 002/trt 1122 . Allerg1
study2 003/trt 1122 . Allerg1
study2 003/trt 1122 . Allerg2
study2 003/trt 1120 . Allerg3
;
proc format;
picture fmt
low-high='00009mg';
run;
ods graphics/height=10in width=10in noscale;
proc sgpanel data=have noautolegend nocycleattrs pad=0px;
panelby study/layout=panel columns=2 onepanel novarname ;
hbarparm category=group response=value1/group=sub_group fillpattern nofill groupdisplay=cluster datalabel=sub_group;
hbarparm category=group response=value2/group=sub_group groupdisplay=cluster;
colaxis display=(nolabel) fitpolicy=ROTATEALWAYS VALUESROTATE=vertical values=(0 to 1200 by 50) valuesformat=fmt.;
rowaxis display=none colorbands=even;
rowaxistable group2/ position=left VALUEJUSTIFY=right labelattrs=(color=white size=0) valueattrs=(size=10);
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.