BookmarkSubscribeRSS Feed
Miracle
Barite | Level 11

Dear everyone,

How are you?

Can I please ask how do I join the 2 points (amount in 2000 & 2001) of the same individual in each level of the x-axis?

Thank you for your help.


FYI here is the code.

ods graphics / antialias=off;

proc sgplot data=tmp;

  scatter x=item01 y=amt / group=year groupdisplay=cluster clusterwidth=0.5;

  xaxis type=discrete;

run;

ods graphics off;

SGPlot7.png

1 REPLY 1
Jay54
Meteorite | Level 14

The answer always depends on the SAS release you are using.  Please include program and sample data so we can run the use case.  In the graph above, YEAR is a group role, so values for 2000 and 2001 are plotted as side by side clusters. They do not have specific axis values.

Your best bet is to plot a graph using SGPANEL, with PANELBY=item01.  Then, each panel can have a SERIES x=year y=amount.  You can use other options to move the header values down to look like axis values, and suppress cell borders, etc.

Potentially, if you have SAS9.40M1, you could define data for a POLYGON plot using discreteoffset=column to draw lines between each group value, but that may be more laborious, but better than SGAnnotate.

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
  • 1 reply
  • 760 views
  • 3 likes
  • 2 in conversation