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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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