BookmarkSubscribeRSS Feed
HyunJee
Fluorite | Level 6

I am attempting to plot a fourth variable on a plot using the pointlabel statement. It works essentially, but I cannot figure out why the lines are interconnecting between the different values of my fourth variable and why there are multiple labels around a single data point. Below is the code I used to generate the attached graph. I appreciate any help or insight anyone can provide - Thanks!

proc sort data=repeatedall;

by year;

run;

goptions reset=all;

symbol v=dot i=join pointlabel= ('#cen_reg') ;

axis1 label = ('predicted') order = (0 to 1 by 0.1);

legend1 position=(inside top right) down=3 label=none;

proc gplot data=repeatedall;

title 'NIS All Predicted';

plot predicted*year=recom_value/ vaxis=axis1; * haxis=axis2 legend=legend1;

format recom_value recf.;

run;

quit;ut th

1 REPLY 1
GraphGuy
Meteorite | Level 14

There are several different ways to arrange/organize your data, and different ways to plot it with gplot.

You might need to take a slightly different approach, depending on exactly what you're wanting to plot.

In general, if you are getting lines connecting things in your plot that you don't want connected, you can insert some sas 'missing values' into the data, and then use gplot's "skipmiss" option to have it put a gap in the line (not connect the points) where it hits a missing value.

Something like the following (untested pseudo-code) ...

data foo; set foo;

by year;

output;

if last.year then do;

  y_value=.;

  output;

  end;

run;

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
  • 812 views
  • 3 likes
  • 2 in conversation