Hi,
Im using this code to create the following plot in rtf. im using sas studio .0.
The issue i have are:
1) need a couple of space between the blue and red bars (not individual bars). I tried clusterwidth and its not working.The vertical dashed line has to ob on the space between the blue group and red group.
2) I also need a label under each group just below the x axis line (not the legend) .
proc sgplot data=adtss2 noautolegend;
vbar pos/ response=PCHG group=ESMMB GROUPDISPLAY=CLUSTER clusterwidth=1 barwidth=.8/*FILLATTRS = (COLOR=lightblue)*/ nooutline;
refline 25,35 / axis=y lineattrs=(pattern=shortdash color=grey);
refline &xref / axis=x lineattrs=(pattern=shortdash color=black);
xaxis display =none;
yaxis label="Change from baseline (%)" values= (-100 to 100 by 10) valuesdisplay=('<=100' '-90' '-80' '-70' '-60' '-50' '-40' '-30' '-20' '-10' '0' '10' '20' '30' '40' '50' '60' '70' '80' '90' '>=100') valueshint;
run;
Thanks
Manj
/*
Why not try PROC SGPANEL ?
Next time if you want get answer,
It better to post some data to test your code.
*/
data have;
call streaminit(123);
do id=1 to 100;
sex=ifc(id<70,'M','F');
p=rand('integer',-100,100);
output;
end;
run;
proc sort data=have;by descending sex descending p;run;
data want;
set have end=last;
by descending sex;
output;
if last.sex and not last then do;
do id=99991 to 99999;
p=0;output;
end;
end;
run;
proc sgplot data=want noautolegend;
vbarparm category=id response=p/group=sex ;
refline 99995/axis=x lineattrs=(pattern=shortdash color=black);
xaxis display =(noticks novalues noline) discreteorder=data
label='Treatment(N=44) Placebo(N=67)';
yaxis label="Change from baseline (%)" values= (-100 to 100 by 10)
valuesdisplay=('<=100' '-90' '-80' '-70' '-60' '-50' '-40' '-30' '-20'
'-10' '0' '10' '20' '30' '40' '50' '60' '70' '80' '90' '>=100') ;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.