Hi,
I am trying to genrate the waterfall plot , but in data there is no all legend vlauee and only diaplay in legend what are in data.
But i need to display all values which are defined in proc format.
Below is sample output :
My Code is :
ods listing close;
ods graphics on / border=off width=22.86cm height=9.5cm;
proc sgplot data=final noborder noautolegend;
by trt01a;
format resp $rsf.;
refline -50 / axis=y lineattrs=(pattern=shortdash);
vbar subjid/response = pchg categoryorder=RESPDESC group=resp;
xaxis label = "Patient Number" fitpolicy = ROTATE;
yaxis label = "Maximum Percent Reduction from Baseline in SPD" min=&minp. max=&maxp. values=(-120 to 50 by 20);
keylegend /title = 'IPCGS' location=inside position=topright;
run;
ods rtf close;
ods listing;
ods graphics off;My current output : add one more group that is "PD" progressive disease
How to display this water fall as per sample display
Thank you.
Raja
You can use a discrete attributes map to do it. You can use the map to control both the attributes for the plot , as well as whether the legend content is driven by the map instead of the data. This last behavior is controlled by the SHOW=ATTRMAP option in the map data. Here is a simple example of a map using the active style's attributes but using SHOW=ATTRMAP to have its content used for the legend. In your case, put all five possible responses in the map.
data attrmap;
retain ID "myid" show "attrmap";
length value $ 7 fillstyleelement $ 10 linestyleelement $ 10;
input value $ fillstyleelement $ linestyleelement $;
cards;
M GraphData1 GraphData1
F GraphData2 GraphData2
Unknown GraphData3 GraphData3
;
run;
proc sgplot data=sashelp.class dattrmap=attrmap;
vbar age / response=weight group=sex groupdisplay=cluster stat=mean attrid=myid;
run;
Another workaround way is using LEGENDITEM statement.
proc sgplot data=sashelp.class;
vbar age / response=weight group=sex groupdisplay=cluster stat=mean name='x';
legenditem name='u' type=fill/fillattrs=(color=gray) label='Unknown';
keylegend 'x' 'u';
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 save with the early bird rate—just $795!
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.