I would like to insert a graphic to the right of a graph I have created. (The graph was created using proc gchart). I have created three lines using the annotate data set and would like to insert a graphic that gives an explanation as to what these lines are - like a legend of sorts. I have tried just inserting text above the lines where the annotate date set, but that doesn't work in this case. (It does the job. I just don't like the way it looks on the graph.)
I know I could add an image below the graph, but for space purposes I would prefer it to the right.
Is this possible in SAS? If so, can someone direct me to a resource that has information related to this? I have searched online but can't find information related to this.
Well, you can put outputs out to multiple regions using ods region:
Not sure how this ties into your code, I would suggest you move to sgplot or GTL though, more flexibility.
Thanks RW9. I am not sure how ods region would work since I want one column at the top of the page and essentially two columns at the bottom - one with the graph, the other with the image next to it. I am also going to look at sgplot though. You mentioned GTL. I am not sure how to use that for this.
Using SGPLOT, you can reserve some space to the right of the graph (PAD=(RIGHT=10pct)), and then add the image in that location using SGANNO functioni. Note, this works similar to Annotate, with Functions, etc, but has different syntax due to its need to work with SGPLOT.
This paper explains how to add SGANNO annotations to a SGPLOT graph. Images are included in the data in Fig 11. It should be straight forward to place images on the right of the graph.
Well, I see Sanjay has jumped in and given you a solution which is great. I would just add, as he is too modest, that his excellent blog will give you all the information you need to use sgplot and GTL (Graph Template Language) which is the underlying graph proc template language which is used to generate graphs.
(although in this instance, it was a different solution, its still a good idea to look into.)
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.