I have a issue where i want to have a group vbar with only group which has nonmissing data.
data WORK.FINAL;
infile datalines dsd truncover;
input aetoxgr:$12. pct_toxg:PERCENT8. new_subj:$29. EXDOSE:32.;
format pct_toxg PERCENT8.;
datalines4;
Grmdr1,8%,C1D1(n=12),0.3
Grmdr1,33%,C1D1(n=12),1
Grmdr2,8%,C1D1(n=12),1
Grmdr1,10%,C1D8(n=10),3
Grmdr1,10%,C1D8(n=10),10
Grmdr2,10%,C1D8(n=10),3
Grmdr2,20%,C1D8(n=10),10
Grmdr3,10%,C1D8(n=10),10
Grmdr1,13%,C1D15(n=8),30
Grmdr2,13%,C1D15(n=8),30
Grmdr3,13%,C1D15(n=8),30
Grmdr2,25%,C2D1(n=4),10
Grmdr1,50%,C2D8(n=4),10
;;;;
i want to remove nonmissing legends as highlighted in attachedment with blue marker and also get percentages as shown in second sample figure attached, not sure how to do,
Can anyone please help.
I used the below code
proc template;
define statgraph final2;
begingraph / datacolors=(lightblue lightgreen orange red cyan);
layout datalattice columnvar=new_subj/
rowaxisopts=( Label=' ' offsetmin=0)
columnaxisopts=(offsetmin=0.3 offsetmax=0.3 display=(ticks tickvalues))
headerlabeldisplay=value headeropaque=false columnheaders=bottom;
layout prototype /walldisplay=none;
BarChartParm X=exdose Y=pct_toxg / primary=true Group=aetoxgr
NAME="Status" groupdisplay=stack barwidth=0.9;
Scatterplot x=exdose y=yScatter / group=aetoxgr
markercharacter=pct_toxg labelstrip=true
markercharacterattrs=(size=16 weight=bold color=white);
endlayout;
endlayout;
layout globallegend;
DiscreteLegend "Status"/ title="Toxicity Grade";
endlayout;
endgraph;
end;
run;
ods listing gpath='output\';
ods graphics / imagename="test" imagefmt=png;
proc sgrender data=final2 template=final2;
run;
ods graphics off;
Try this one, you can use Proc SGPANEL.
proc sgpanel data=final;
styleattrs datacolors=(lightblue lightgreen orange red cyan);
panelby new_subj / layout=columnlattice novarname columns=5 colheaderpos=bottom uniscale=row noborder;
vbarbasic exdose / response=pct_toxg group=aetoxgr seglabel;
colaxis type=discrete display=(nolabel);
keylegend / title="Toxicity Grade";
run;
Is this the result you are looking for?
For the scatterplot we are missing a variable in the data.
No attachment
sorry attached now
Try this one, you can use Proc SGPANEL.
proc sgpanel data=final;
styleattrs datacolors=(lightblue lightgreen orange red cyan);
panelby new_subj / layout=columnlattice novarname columns=5 colheaderpos=bottom uniscale=row noborder;
vbarbasic exdose / response=pct_toxg group=aetoxgr seglabel;
colaxis type=discrete display=(nolabel);
keylegend / title="Toxicity Grade";
run;
Is this the result you are looking for?
For the scatterplot we are missing a variable in the data.
Thanks a lot, it works pretty much except ordering which i gave grouporder=ascending and i created order variable ord and it was ordered at final step but it misses
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.