How can you control the order of bars in a barchart created in GTL? I sorted the bar variable (percent) in descending order but the plot orders in the bars alphabetically be the group variable (prinaquifer2). /*calculate detection frequency of Pb210 by category in percentage*/ proc freq data=b; by PrinAquifer2; tables H17503*PrinAquifer2 / noprint out=Freq1Out; /* save Percent variable */ run; data Freq2Out; set Freq1Out; if H17503=0 then delete; Percent = Percent / 100; format Percent PERCENT5.; run; proc sort data=Freq2Out; by descending Percent; run; /*combine data sets*/ data plot; set b Freq2Out; keep PrinAquifer2 percent P17503; run; proc template; define statgraph testplot; begingraph; layout overlay / Backgroundcolor=CXFFFFFF Border=False Wallcolor=CXFFFFFF Opaque=False yaxisopts=(label="Detection Frequency" linearopts=(viewmin=0 viewmax=1 tickvaluesequence=(start=0 end=1 increment=.2))) y2axisopts=(type=log label="Pb-210 (pCi/L)") xaxisopts=(display=(line ticks tickvalues)); barchart x=PrinAquifer2 y=percent; boxplot x=PrinAquifer2 y=P17503 / yaxis=y2 fillattrs=(color=CXFFFFFF) ; endlayout; endgraph; end; run; ods graphics / width=450px; ods listing; *ods latex path="C:\NYBackup\projects\Glacial\Publications\Po210nPb210\Pb210"; *ods graphics on / imagefmt=pdf; proc sgrender data=plot template=testplot; run; *ods graphics off; *ods latex close; run; quit;
... View more