Did you know that you can embed one graph inside another by using PROC SGPLOT in SAS? A typical example is shown to the right. The large graph shows kernel density estimates for the distribution of the Cholesterol variable among male and female patients in a heart study. The small
Search Results: sgplot (964)
Labeling objects in graphs can be difficult. SAS has a long history of providing support for labeling markers in scatter plots and for labeling regions on a map. This article discusses how the SGPLOT procedure decides where to put a label for a polygon. It discusses the advantages and disadvantages
A SAS programmer was trying to understand how PROC SGPLOT orders categories and segments in a stacked bar chart. As with all problems, it is often useful to start with a simpler version of the problem. After you understand the simpler situation, you can apply that understanding to the more
A SAS programmer asked how to display long labels at irregular locations along the horizontal axis of scatter plot. The labels indicate various phases of a clinical study. This article discusses the problem and shows how to use the FITPOLICY=STAGGER option on the XAXIS or X2AXIS statement to avoid collisions
The SGPLOT procedure supports a wide variety of plot types that you can use directly or combine together to create more complex graphs. Even with this flexibility, there might be times you run across a graph that you cannot create using one of the standard plot types. An "area" bar
It can be frustrating to receive an error message from statistical software. In the early days of the SAS statistical graphics (SG) procedures, an error message that I dreaded was ERROR: Attempting to overlay incompatible plot or chart types. This error message appears when you attempt to use PROC SGPLOT
The REFLINE statement in PROC SGPLOT is one of my favorite ways to augment statistical graphics such as scatter plots, series plots, and histograms. The REFLINE statement overlays a vertical or horizontal reference line on a graph. You can specify the location of the reference lines on the REFLINE statement.
As we continue to process and understand the ongoing effects of the novel coronavirus, many of us have grown used to viewing COVID-19 dashboards and visualizations, including this popular coronavirus dashboard from SAS. If you are more accustomed to building graphs and visualizations using the SGPLOT and SGPANEL procedures, this
Ridgeline plots are useful for visualizing changes in the shapes of distribution over multiple groups or time periods. Let us look at an example of how we can create this plot using the SGPLOT procedure that is part of the ODS Graphics Procedures. For this example, we will plot the
The TEXT statement in PROC SGPLOT supports the ROTATE= option to rotate the specified text. It is worth knowing how the ROTATE= option interacts with the POSITION= option, which determines the anchor point at which the text is positioned. Briefly, the text is positioned FIRST, then the rotation occurs. The
A SAS programmer asked an intriguing question on the SAS Support Communities: Can you use SAS to create a graph that shows how the elements in a box-and-whiskers plot relate to the data? The SAS documentation has several examples that explain how to read a box plot. One of the
A few years ago Mandelbrot sets and fractals were all the rage! (Am I showing my age? Hahaha!) I thought creating some plots of this type of data would be a good way to sharpen my SAS programming skills, and it would make a nice/interesting example to help teach people
Heat maps have many uses. You can use a heat map to visualize correlation matrices, to visualize longitudinal data ("lasagna plots"), and to visualize counts in any two-dimensional table. As of SAS 9.4m3, you can create heat maps in SAS by using the HEATMAP and HEATMAPPARM statements in PROC SGPLOT.
You've probably heard of the famous Rosetta Stone. It had the same decree written on it in both ancient Egyptian and Greek, and was an essential key to help modern historians decipher and translate the ancient Egyptian hieroglyphs. To help the 'old timers' (like me) shift from using SAS/Graph to the
You've probably heard of the famous Rosetta Stone. It had the same decree written on it in both ancient Egyptian and Greek, and was an essential key to help modern historians decipher and translate the ancient Egyptian hieroglyphs. To help the 'old timers' (like me) shift from using SAS/Graph to
A few years ago Sanjay showed how to create a polar graph by creating a gtl template, and then plotting it using Proc SGRender. These days, Proc SGPlot has all the functionality you need to create this graph, therefore I've rewritten the example to just use SGPlot. And while I
Plotting just your data often helps you gain insight into how it has changed over time. But what if you want to know why it changed? Although correlation does not always imply causation, it is often useful to graph multiple things together, that might logically be related. For example, recessions
You might have noticed I've been trying out SAS ODS Graphics lately, whereas in the past I mainly used SAS/Graph for my samples. In this blog post I step you through my latest fancy SGplot graph - hopefully you'll learn some tips & techniques, as you follow along. (I don't
When you overlay two series in PROC SGPLOT, you can either plot both series on the same axis or you can assign one series to the main axis (Y) and another to a secondary axis (Y2). If you use the Y and Y2 axes, they are scaled independently by default,
When a graph includes several markers or line styles, it is often useful to create a legend that explains the relationship between the data and the symbols, color, and line styles in the graph. The SGPLOT procedure does a good job of automatically creating and placing a legend for most
A useful feature in PROC SGPLOT is the ability to easily visualize subgroups of data. Most statements in the SGPLOT procedure support a GROUP= option that enables you to overlay plots of subgroups. When you use the GROUP= option, observations are assigned attributes (colors, line patterns, symbols, ...) that indicate
The STYLEATTRS statement in PROC SGPLOT enables you to override colors, markers, line patterns, fill patterns, and axis break patterns in ODS styles, without requiring you to change the ODS style template.
You can use PROC SGPLOT, BY variables, and a SG annotation data set together to put separate annotations into each BY group. However, you need two more steps to make it happen. This post shows all of the steps necessary to put different annotations into each graph when you have a BY variable.
The LOESS statement in PROC SGPLOT finds a fit function while making no assumptions about the parametric form of the regression function.
You can use penalized B-splines display a smooth curve through a set of data. The PBSPLINE statement fits spline models, displays the fit function(s), and optionally displays the data values.
The REG statement fits linear regression models, displays the fit functions, and optionally displays the data values. You can fit a line or a polynomial curve. You can fit a single function or when you have a group variable, fit multiple functions.
Survival plots are automatically created by the LIFETEST procedure. These graphs are most often customized to fit the needs of SAS users. One way to create the customized survival plot is to save the generated data from the LIFETEST procedure, and then use the SGPLOT procedure to create your custom
PROC SGPLOT looks at the PROC statements, it looks at the data, and it writes a template that might depend on the data. If you want to understand how the graph is created, you need to look at the PROC SGPLOT code, the graph template and data objects that it constructs, and the final graph.
This post shows you how to run PROC SGPLOT, create smooth curves by using penalized B-splines, use ODS OUTPUT to create an output data set from PROC SGPLOT, and process it to display drop lines.
This is the 9th installment of the "Getting Started" series, and the audience is the user who is new to the SG Procedures. It is quite possible that an experienced users may also find some useful nuggets here. In this article, we will cover the basics of the BUBBLE plot.