Excel lines (blue) and axes (gray) can easily introduce arrow tips as follows:
I tried to do this in SGPLOT but couldn't find LINEATTRS or something for these arrow tips.
Are the arrow tips above also available for SGPLOT SERIES and axes? Here is a sample snippet.
data work;
do x=1 to 10;
y+rannor(1);
output;
end;
run;
ods results=off;
ods listing gpath='!userprofile\desktop';
ods graphics/reset noborder imagename='versionsas';
proc sgplot;
series x=x y=y;
run;
Thanks for your help!
SG procs do not provide arrows on axes. But you could use SG annotation to achieve this:
data have;
call streaminit(86585);
do x=1 to 10;
y+rannor(1);
output;
end;
run;
data annoset;
function = "ARROW"; shape = "FILLED"; drawspace = "WALLPERCENT";
y1 = 0; y2 = 0; x1 = 0; x2 = 100; output;
function = "ARROW"; shape = "FILLED"; drawspace = "WALLPERCENT";
y1 = 0; y2 = 100; x1 = 0; x2 = 0; output;
run;
proc sgplot data=have noautolegend sganno=annoset;
series x=x y=y/ARROWHEADPOS=both ARROWHEADSHAPE=filled ;
run;
data work;
do x=1 to 10;
y+rannor(1);
output;
end;
run;
data want;
set work ;
if _n_=1 then do;_y=2;_x=11;end;
run;
proc sgplot noautolegend;
series x=x y=y/ARROWHEADPOS=end ARROWHEADSHAPE=filled ;
scatter x=_x y=_y/markerattrs=(symbol=trianglerightfilled color=grey);
refline 2/axis=y ;
yaxis grid ;
xaxis offsetmax=0.01;
run;
Does xaxis
or yaxis
have something similar to arrowheadpos
for series
? I want to apply the arrow tips for axes per se as follows:
Many thanks for your help again.
SG procs do not provide arrows on axes. But you could use SG annotation to achieve this:
data have;
call streaminit(86585);
do x=1 to 10;
y+rannor(1);
output;
end;
run;
data annoset;
function = "ARROW"; shape = "FILLED"; drawspace = "WALLPERCENT";
y1 = 0; y2 = 0; x1 = 0; x2 = 100; output;
function = "ARROW"; shape = "FILLED"; drawspace = "WALLPERCENT";
y1 = 0; y2 = 100; x1 = 0; x2 = 0; output;
run;
proc sgplot data=have noautolegend sganno=annoset;
series x=x y=y/ARROWHEADPOS=both ARROWHEADSHAPE=filled ;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.