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;
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.