BookmarkSubscribeRSS Feed
GallagherML
Calcite | Level 5

Hi all,

 

I have a more conceptual question to ask--what exactly is the difference between INSET statement and KEYLEGEND statement? 

 

I want to create a legend outside of the individual graphs, but on the same panel. I think INSET could be utilized, but I saw that KEYLEGEND statement was available. What is the difference? Does it depend on what I want to do? 

As a note, I am trying to create a legend that displays 'varname1 = Variable Name 1,' but I also want to know on a more fundamental level the differences.

Thanks y'all

2 REPLIES 2
Rick_SAS
SAS Super FREQ

An inset is used to add text to the plot. For example, on a histogram, you might want to add an inset that includes the text "Mean = 5.2" and "Standard Deviation 8.9".

 

The KEYLEGEND statement is used to identify graphical elements of the plot. It shows things like markers and lines, and identifies the categories associated with colors. It is used when you are overlaying multiple graph elements (scatter plots, series plots, band plots,....) but only you want the legend to show a few of the elements because the others are obvious from context or from explanatory text in the document. To include only some elements in the legend, use NAME= option to name itemd and then refer to those names in the KEYLEGEND statement. 

 

The doc has examples of both. Here is a doc example for KEYLEGEND.

Here is a doc example for INSET.

 

Rick_SAS
SAS Super FREQ

Do you have additional questions on this topic? If not, you can close the thread by marking a correct answer.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 896 views
  • 0 likes
  • 2 in conversation