Do you have a complex multi-cell graph created in ODS Graphics Designer that you’d like to reuse with different data? Ideally, you’d like to change the data without having to change the plots in each cell. The designer’s shared variable feature provides an easy way to build and reuse graphs with different data. With shared variables, you associate one or more shared variables with the data roles in your plots.
To create a shared-variable graph, select File > New > Blank Shared Variable Graph. Then define one or more shared variables.
Then, you build the graph by using the defined shared variables. Now, changing the data assignment in a graph is simply a matter of changing the data assigned to the shared variables. You make this change once, and the change is applied to all the plots in the graph. Shared variables are most effective for creating graphs that have many plots and that use very few (one or two) variables.
You can also run shared-variable graphs in batch mode by using the SGDESIGN procedure. You can specify different variables in the same or in a different data set by using the DYNAMIC option.
Finally, you can use the DYNAMIC option to generate a dynamic title that changes to match the data that is used to generate the graph.
Going to SAS Global Forum 2017?
Meet Sanjay and ask him more about this or his newest book, SAS ODS Graphics Designer by Example: A Visual Guide to Creating Graphs Interactively. Join us at the Data Visualization lunch at SAS Global Forum for this great opportunity!
Now for some more fun…have a tip to share?
If you are among the first 5 people to comment on this blog post with a tip or trick related to this topic, you could win a hardcopy of either Clinical Graphs Using SAS® or SAS® ODS Graphics Designer by Example.
Be sure to enter your e-mail address when you write your comment so we can contact you if you are a winner. Only one book per commenter and for U.S. addresses only.
Want tips on other topics? Check out these great tricks.