BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

Excel lines (blue) and axes (gray) can easily introduce arrow tips as follows:

versionexcel.png

I tried to do this in SGPLOT but couldn't find LINEATTRS or something for these arrow tips.

versionsas.png

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!

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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;

PGStats_0-1668023287931.png

 

PG

View solution in original post

3 REPLIES 3
Ksharp
Super User
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;

Ksharp_0-1667993976688.png

 

Junyong
Pyrite | Level 9

Does xaxis or yaxis have something similar to arrowheadpos for series? I want to apply the arrow tips for axes per se as follows:

arrow-tipped.png

Many thanks for your help again.

PGStats
Opal | Level 21

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;

PGStats_0-1668023287931.png

 

PG

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1568 views
  • 4 likes
  • 3 in conversation