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

I am relatively inexperienced when it comes to SAS procedures related to graphs.  I would like to know what SAS procedure, if any, I can use to produce a graph in the format attached.  It contains two series graphed vertically as bars and three reference lines.  I have used proc gbarline for other graphs that contain only one vertical series and have two reference lines.  However, I am having difficulty getting that to work with the two series I need to graph.  Also, any help with the SAS code is greatly appreciated.  Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Instead of plotting two separate series it may be better to create a group variable to define which value is associated with the series.

With SGPLOT you would have a VBAR statement using that group variable. One example is here: http://support.sas.com/kb/43/731.html

Also you can add one or more REFLINE statements, which seem more appropriate from your example than a series.

A statement like:

Refline 90 / axis=y Label='Minimum Goal' labelloc=outside;

places a line across the graph at a value of 90 and places a label outside the graph with the text.

 

 

View solution in original post

3 REPLIES 3
ballardw
Super User

Instead of plotting two separate series it may be better to create a group variable to define which value is associated with the series.

With SGPLOT you would have a VBAR statement using that group variable. One example is here: http://support.sas.com/kb/43/731.html

Also you can add one or more REFLINE statements, which seem more appropriate from your example than a series.

A statement like:

Refline 90 / axis=y Label='Minimum Goal' labelloc=outside;

places a line across the graph at a value of 90 and places a label outside the graph with the text.

 

 

Jay54
Meteorite | Level 14

Another way to make the same program work with multiple reference lines is to add the reference values to a column ( say A) in your data.  Then, you can use the column in thr REFLINE stmt:  refline a;  This works well if you have a panel, and want different reference lines by the panel variable (SGPANEL).

KelseyB
Fluorite | Level 6

Thank you Sanjay.  This was helpful!

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
  • 3 replies
  • 1752 views
  • 1 like
  • 3 in conversation