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

I'm more familiar with SGPLOT than GPLOT so

 

1. How do I set a reference line on the y-axis?

2. How do I change the color for values at or above a certain level?

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

First question is why Gplot?

Might help to show your existing code.

 

VREF=value or value list will draw reference lines perpendicular to the vertical axis (i.e. at Y axis values)

There are multiple other options to work with the VREF: CVREF to set colors, LVREF to set line type. WVREF to set line widths, and then a similar set for AUTOVREF if you want a reference line at each axis tick mark.

HREF and similar for the Horizontal axis.

Where a value list is used it looks like VREF= 300 1000 1500 to set 3 reference lines at Yaxis values of 300, 1000 and 1500.

 

It has been a long time since I used GPLOT much (think last century). If I wanted to change the color of a line plot based on a value then I would set a variable to different values for different ranges and match those values to SYMBOL statements. The kicker is going to be extra coding to avoid gaps if doing a line chart and Bubble charts would be a nightmare if you want to color only part of a bubble.

 

 

View solution in original post

2 REPLIES 2
WarrenKuhfeld
Ammonite | Level 13

Don't use GPLOT. SGPLOT is so much better.

ballardw
Super User

First question is why Gplot?

Might help to show your existing code.

 

VREF=value or value list will draw reference lines perpendicular to the vertical axis (i.e. at Y axis values)

There are multiple other options to work with the VREF: CVREF to set colors, LVREF to set line type. WVREF to set line widths, and then a similar set for AUTOVREF if you want a reference line at each axis tick mark.

HREF and similar for the Horizontal axis.

Where a value list is used it looks like VREF= 300 1000 1500 to set 3 reference lines at Yaxis values of 300, 1000 and 1500.

 

It has been a long time since I used GPLOT much (think last century). If I wanted to change the color of a line plot based on a value then I would set a variable to different values for different ranges and match those values to SYMBOL statements. The kicker is going to be extra coding to avoid gaps if doing a line chart and Bubble charts would be a nightmare if you want to color only part of a bubble.

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2 replies
  • 1493 views
  • 0 likes
  • 3 in conversation