In a recent article on efficient simulation from a truncated distribution, I wrote some SAS/IML code that used the LOC function to find and exclude observations that satisfy some criterion. Some readers came up with an alternative algorithm that uses the REMOVE function instead of subscripts. I remarked in a
Search Results: sgplot (964)
A recent question by a user lead led me to experiment with what is often referred to as conditional highlighting. The user wanted to display a bar chart of response by year, where each bar is colored by year, and show a cross hatch pattern on the bars where the
Last week I attended my first SCSUG conference, this one in Houston. Houston, the fourth most populous city in USA, is the world's capitol of the Oil and Gas industry. So it was no surprise I met many attendees from local oil and gas related companies. But, I also met many
It's not too early to think about what presentations and pre-conference training to attend while at SAS Global Forum 2012. Tutorials are an extra-fee that is only available as additions to a conference registration. But you can get a deal: Registration package 3 includes your choice of one Sunday Pre-Conference Tutorial.
What's in a name? As Shakespeare's Juliet said, "That which we call a rose / By any other name would smell as sweet." A similar statement holds true for the names of colors in SAS: "Rose" by any other name would look as red! SAS enables you to specify a
Sometimes a graph is more interpretable if you assign specific colors to categories. For example, if you are graphing the number of Olympic medals won by various countries at the 2012 London Olympics, you might want to assign the colors gold, silver, and bronze to represent first-, second-, and third-place
The New York Times has an excellent staff that produces visually interesting graphics for the general public. However, because their graphs need to be understood by all Times readers, the staff sometimes creates a complicated infographic when a simpler statistical graph would show the data in a clearer manner. A
Last week I wrote a SAS/IML program that computes the odds of winning the game of craps. I noted that the program remains valid even if the dice are not fair. For convenience, here is a SAS/IML function that computes the probability of winning at craps, given the probability vector
It is easy to simulate data that is uniformly distributed in the unit cube for any dimension. However, it is less obvious how to generate data in the unit simplex. The simplex is the set of points (x1,x2,...,xd) such that Σi xi = 1 and 0 ≤ xi ≤ 1
During SAS Global Forum 2012, I had conversations with many SAS users who wanted to create Forest Plots. However, there was one new twist. The study names were subgrouped by categories like 'Age', 'Sex', etc., with multiple entries under each subgroup. The name of each study within the subgrouped was indented
Robert Allison posted a map that shows the average commute times for major US cities, along with the proportion of the commute that is attributed to traffic jams and other congestion. The data are from a CEOs for Cities report (Driven Apart, 2010, p. 45). Robert use SAS/GRAPH software to
A few weeks ago I wrote an article on using the non breaking space character to prevent stripping of leading and trailing blanks in a string. Since then, I have discovered a few more instances where the nbsp can be a useful tool for creating graphs. One such instance came up last week
Pie charts have been the subject of some criticism when they are used to compare measures across multiple categories. It is generally accepted that comparison of magnitudes represented as angular measures from varying baselines is not effective. However here are some use cases where a pie chart does quite well. When it comes
Sometimes a small option can make a big difference. Last week I thought to myself, "I wish there were an option that prevents variable labels from appearing in a table or graph." Well, it turns out that there is! I was using PROC MEANS to display some summary statistics, and
Forest plots come in many flavors. An example of a Forest plot using GTL is available on the SAS support web site. Simple forest plots can also be created using SGPLOT procedure by using the SCATTER statement with MARKERCHAR to display data aligned with the plot by study names. One issue
I've seen analyses of Fisher's iris data so often that sometimes I feel like I can smell the flowers' scent. However, yesterday I stumbled upon an analysis that I hadn't seen before. The typical analysis is shown in the documentation for the CANDISC procedure in the SAS/STAT documentation. A (canonical)
In the Clinical Research domain, there is often the need to display lab values by treatment or test and it is often useful to view this data along with reference lines showing the normal ranges. The obvious way is to use reference lines to denote the normal ranges. SGPLOT Code: proc sgplot data=band; scatter x=x y=y
Many SAS procedures can produce ODS statistical graphics as naturally as they produce tables. Did you know that it is possible to obtain the numbers underlying an ODS statistical graph? This post shows how. Suppose that a SAS procedure creates a graph that displays a curve and that you want
When comparing results by category and group, putting the items to be compared close together usually leads to a graph that is easier to decode. Take the case of the data (simulated) shown below. Here we have population by age group and sex. To compare the population by sex, it is
A key element of graphs used for analysis of safety data for clinical research is the inclusion of statistical data (or tables) about the study that are aligned with the x axis of the graph. A common example of this comes from the paper "Graphical Approaches to the Analysis of
Spark lines, made popular by Edward Tufte, provide a way to visualize trends in a concise space, often inline with the rest of the narrative or data. Previously, I posted an article on Spark Plots in which I created different plot types, some of which included multiple graphs and data in each row. For such
When I need to graph a function of two variables, I often choose to use a contour plot. A surface plot is probably easier for many people to understand, but it has several disadvantages when compared to a contour plot. For example, the following statements in SAS/IML Studio displays a
The Swiss army knife is known for its versatility, with a variety of tools and blades to help you complete the task at hand. When you are creating graphics, you sometimes have a special feature you want to add, but you can't seem to find the right syntax "tool" to
Statistical graphs often include display of derived statistics along with the raw data. Often these statistics are presented in a tabular format inside the graph. With SGPLOT procedure, a table of statistics can be added to the graph as an inset table, as shown below. Using a Stat Table: SGPLOT code:
ODS Graphics components like GTL and SG procedures are designed to work with Styles to create graphs that are effective in the delivery of information and aesthetically pleasing out of the box. You no longer have to tweak the colors to ensure a nice graph. The graph derives all the
If you are like many SAS Enterprise Guide users, you've amassed a large collection of project files (EGP files) that contain important content: programs, logs, notes, results, and more. However, to most tools and processes, the EGP file is opaque. That is, you can't see what's inside of it unless
A graph in a recent article in Fortune magazine caught my eye. The graph shows the cost of hosting the Summer Olympics over the past eight events. Here is what I termed the "Medal" graph. Now, practitioners of the art of Effective Graphics would likely find some shortcomings in the graph. Clearly
PharmaSUG 2012 conference drew to a close today, concluding two and a half days packed with papers, presentations, posters, hands-on demos and super demos by SAS staff. While the weather outside was a bit chilly from time to time, the conference what hopping with many user papers on how to
I've been a fan of statistical simulation and other kinds of computer experimentation for many years. For me, simulation is a good way to understand how the world of statistics works, and to formulate and test conjectures. Last week, while investigating the efficiency of the power method for finding dominant
When I was at SAS Global Forum last week, a SAS user asked my advice regarding a SAS/IML program that he wrote. One step of the program was taking too long to run and he wondered if I could suggest a way to speed it up. The long-running step was