Hi all
With the following code:
ods listing style=htmlblue;
ods graphics / width=10in height=5in;
ods text="^S={fontweight=bold fontsize=15pt} Interaction Index drivers: Efficency vs Efficacy Cy vs Py";
proc sgplot data=inter_tot noautolegend;
bubble x=Yoy_NInter y=Yoy_NSourced size=Sourced_Vol2020 / group=countryname datalabel=countryname
transparency=0.4 datalabelattrs=(size=9 weight=bold);
xaxis grid min=-1 max=1 values=(-1 to 1 ) ;
yaxis grid min=-1 max=1 values=(-1 to 1 ) ;
REFLINE 0 / axis=x;
REFLINE 0 / axis=y;
refline -0.15 / axis=y lineattrs=(color=green thickness=3px
pattern=ShortDashDot);
lineparm x=0 y=0 slope=1; /** intercept, slope **/
inset "Inefficency and Inefficacy" / position=bottomright textattrs=(size=11);
inset "Inefficency Producers" / position=topright textattrs=(size=11);
inset "Efficacy & efficency" / position=topleft textattrs=(size=11);
inset "Decrease with efficency" / position=bottomleft textattrs=(size=11);
run;
ods text="Bubble size represents Sourced Vol.";
ods pdf startpage=now;
I get weird results in terms of the derived bubble chart matrix:
- first case X-axis alignment went totally off
- second case all the instances are not included in the chart
this the table behind:
Any suggestion about this weird behavior?
Bests
Solved adding the offset options to the x-axis line of code:
proc sgplot data=drivers&&mkt_nC&i noautolegend;
bubble x=YoyInt y=YoyOpp size=Sourced_Vol / group=inter_yy datalabel=inter_yy
transparency=0.4 datalabelattrs=(size=9 weight=bold);
xaxis grid min=-1 max=1 values=(-1 to 1 ) OFFSETMAX=0 OFFSETMIN=0 ;
yaxis grid min=-1 max=1 values=(-1 to 1 ) OFFSETMAX=0 OFFSETMIN=0 ;
REFLINE 0 / axis=x;
REFLINE 0 / axis=y;
refline -0.15 / axis=y lineattrs=(color=green thickness=3px
pattern=ShortDashDot);
lineparm x=0 y=0 slope=1; /** intercept, slope **/
inset "Inefficency and Inefficacy" / position=bottomright textattrs=(size=11);
inset "Inefficency Producers" / position=topright textattrs=(size=11);
inset "Efficacy & efficency" / position=topleft textattrs=(size=11);
inset "Decrease with efficency" / position=bottomleft textattrs=(size=11);
run;
Solved adding the offset options to the x-axis line of code:
proc sgplot data=drivers&&mkt_nC&i noautolegend;
bubble x=YoyInt y=YoyOpp size=Sourced_Vol / group=inter_yy datalabel=inter_yy
transparency=0.4 datalabelattrs=(size=9 weight=bold);
xaxis grid min=-1 max=1 values=(-1 to 1 ) OFFSETMAX=0 OFFSETMIN=0 ;
yaxis grid min=-1 max=1 values=(-1 to 1 ) OFFSETMAX=0 OFFSETMIN=0 ;
REFLINE 0 / axis=x;
REFLINE 0 / axis=y;
refline -0.15 / axis=y lineattrs=(color=green thickness=3px
pattern=ShortDashDot);
lineparm x=0 y=0 slope=1; /** intercept, slope **/
inset "Inefficency and Inefficacy" / position=bottomright textattrs=(size=11);
inset "Inefficency Producers" / position=topright textattrs=(size=11);
inset "Efficacy & efficency" / position=topleft textattrs=(size=11);
inset "Decrease with efficency" / position=bottomleft textattrs=(size=11);
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.