I hope I'm not missing an easy answer, but it's not for lack of diligence. I'm trying to use GTL to define a fairly basic horizontal bar chart. For the life of me I can't find an option to allow me to sort the bars by frequency. Is there an equivalent GTL option to CATEGORYORDER=RESPDESC? I suspect there is since this is would be a common need.
proc template;
define statgraph FlagBarCharts;
dynamic byvar;
begingraph;
entrytitle "Flag Variable: " byvar ;
layout overlay
/ border=false
WALLDISPLAY=none
xaxisopts=(
label=' '
linearopts=(viewmax=10));
BARCHARTPARM x=subcat y=percent
/ orient=horizontal;
endlayout;
endgraph;
end;
run;
Hi
I'm new to GTL, but I think if you remove the linearopts= option, then the categories will be ordered according to the order of the input dataset. I guess when you added linearopts=, it forced the xaxis to be linear, instead of categorical.
proc template; define statgraph FlagBarCharts; dynamic byvar; begingraph; entrytitle "Flag Variable: " byvar ; layout overlay / border=false WALLDISPLAY=none xaxisopts=( label=' ' ); BARCHARTPARM x=subcat y=percent / orient=horizontal ; endlayout; endgraph; end; run; data in; subcat='1'; percent=2; output; subcat='2'; percent=6; output; subcat='3'; percent=4;output; run; proc sort data=in; by percent; run; ods pdf file="d:\junk\me.pdf"; proc sgrender data=in template=FlagBarcharts; run; ods pdf close;
Hi,
And for more feedback from the heavy hitters and graph gurus in the ODS Graphics area, I recommend posting and looking in the forum that is dedicated to ODS GRAPHICS.
cynthia
Since its a horizontal chart, the linear opts correspond the the response. Removing that doesn't alter the category sorting.
So to re-post it there, should I just copy/paste my message, or is there a way to do that in the software? I guess I'll copy-paste. Thanks !
Bob
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.