BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djrisks
Barite | Level 11

Hello :-),

 

I need to replicate the following image below using SAS 9.4, and I was wondering if there were any easier ways to plot the directional arrows? I have thought about using the vector statement because with that I can specify the start and end of the line, and draw the arrow (in the middle) which will be in the right direction, but I was wondering if I could use any other methods please?

 

directional_arrows.png

 

Thank you in advance for your help.

Kriss

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I think your approach is the best.  If you want to draw the vector from (x1, y1) to (x2, y2), define the midpoint as

m = ( (x1+x2)/2, (y1+y2)/2 ). Then

1. Draw vector from m to (x2, y2). Use the NOARROWHEADS option to suppress the arrow head.

2. In a separate VECTOR statement, draw vector from (x1, y1) to m. Put an arrow head at the end (this is the default).

3. Use the SCATTER statement to overlay the dots at (x1, y1) and (x2, y2).

 

 

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

I think your approach is the best.  If you want to draw the vector from (x1, y1) to (x2, y2), define the midpoint as

m = ( (x1+x2)/2, (y1+y2)/2 ). Then

1. Draw vector from m to (x2, y2). Use the NOARROWHEADS option to suppress the arrow head.

2. In a separate VECTOR statement, draw vector from (x1, y1) to m. Put an arrow head at the end (this is the default).

3. Use the SCATTER statement to overlay the dots at (x1, y1) and (x2, y2).

 

 

djrisks
Barite | Level 11

Great! Thank you for this Rick! 🙂

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 900 views
  • 1 like
  • 2 in conversation