A thunderstorm or rain-drop scatter plot is a useful tool for data visualization and outlier detection, especially for data with two or more values on the y-axis corresponding to one value on the x-axis (Liu, 2013). Liu's paper presents examples on how to produce thunderstorm scatter plots using the SAS/GRAPH annotate facility. The thunderstorm scatter plots can be produced in ODS Graphics SGPLOT without having to use the annotate facility. The "rain-drop" connecting the two data points on the y-axis can be formed by using the HIGHLOW statement.
This posting presents SAS programs in both SAS/GRAPH and ODS Graphics to produce PDF and RTF version of thunderstorm scatter plots based on one of the examples in the original paper. Besides putting all the three thunderstorm figures in one PDF and RTF file, I also tried to save each individual figure in post-script (ps) and enhanced window metafile (emf) file.
The SAS programs, PDF files produced in both GPLOT and SGPLOT, and the Log file are attached (RTF files cannot be atached). I use SAS 9.3.
SAS/GRAPH related questions.
1) Within one GPLOT, when I use more than one plot statements to produce multiple figures, it seems SAS cannot save each figure using the FILENAME statement? I use 3 FILENAME statements trying to save the 3 figures in one GPLOT in either .ps or .emf file but do not see actual files saved.
2) There is a warning "WARNING: Unsupported device 'PSCOLOR' for RTF destination. Using default device 'SASEMF" when the macro %Thunderstorm_GPLOT (driver=sasemf, ext=emf, fontname=Courier New)is called. The SASEMF device driver is specified in the macro, why SAS still gives this warning.
3) When the figures in the PDF file are enlarged (e.g. 10 times) the open and filled circles are not perfect, but in curry shape. I can tell they are still in Vector format with good quality, but curious why they are not in perfect circle? Is this an know issue with SAS/GRAPH? Or something wrong with the fonts I used? the one in SGPLOT are in perfect circles.
ODS Graphics Related Questions
1) The format statement "format subj_index siteid." does not work as expected in SGPLOT. Only part of the site numbers are shown in the x-axis. Anything wrong with the codes?
2) The reference line labels are automatically positioned along the middle of the reference lines. Is there an easy way to put it right after the reference line?
3) In SAS/GRAPH we can use "des=" after the plot statement to specify the lower-level bookmarks. This is not available in SGPLOT, at least in SAS 9.3. Will this feature be available in future release?
Liu, C. 2013. Introducing and Producing Thunderstorm or Rain-drop Scatter Plots Using the SAS/GRAPH® Annotate Facility. SAS Global Forum 2013 Proceedings. http://support.sas.com/resources/papers/proceedings13/357-2013.pdf
TS-674: An Introduction to Exporting SAS/Graph Output to Microsoft Office SAS Release 8.2 and higher. http://support.sas.com/techsup/technote/ts674/ts674.html
It seems SAS/GRAPH related question 1) is caused by turning the ODS listing off. After turning the ODS Listing on, 3 .ps or .emf files are produced from the one GPLOT.
But would still appreciate that you can help with other questions.
For the #1 SGPLOT question, you will get better results by using the macro variables directly in the VALUES statement. It is possible some of the values from the format may not match exactly with the values on the axis.
xaxis values=(1 &ref1. &ref1. &ref2. &ref3. &ref4. ... &ref10.)
When I tried to use "values=(1 &ref1. &ref2. &ref3. &ref4. &ref5. &ref6. &ref7. &ref8. &ref9. &ref10.)" as you suggested in SGPLOT, SAS displayed the reference line values (1, 9, 17, ….110) in the x-axis, not what I intend to achieve. What I want is to display the investigator site number ( 1, 2, 3, …..10) in the x-axis at the corresponding reference line positions (1, 9, 17, ….110), and that's why I use a format statement.
Any other suggestions?
Here's an answer for the Gplot #3 question ...
The built-in gplot symbol markers (dot and circle) have been around for a *long* time, and are built on older technology. If you want nicer/smoother (anti-aliased) markers, based on more modern-day technology, I'd recommend using font-based markers.
For example, you could make the following change:
SYMBOL1 H=2.5 C=RED CO=RED INTERPOL=none W=2 L=1 VALUE=circle;
SYMBOL2 H=2.5 C=BLACK CO=BLACK INTERPOL=none W=2 L=2 VALUE=dot;
SYMBOL1 H=2.5 C=RED CO=RED INTERPOL=none W=2 L=1 font='albany amt/unicode' VALUE='25cb'x;
SYMBOL2 H=2.5 C=BLACK CO=BLACK INTERPOL=none W=2 L=2 font='albany amt/unicode' VALUE='25cf'x;
Which produces the following:
Charlie - is there anything in particular you'd like to know about font-based markers?
You can basically use any character of any font. A couple of 'gotchas' that come to mind are that some characters of some fonts don't "center" well (the characters might be higher/lower or left/right of the actual x/y), and if you're using html mouse-over text or drill downs then you need to be aware that the html area for font-based markers is always rectangular (rather than following the shape of the marker like the old SAS/Graph markers (this can sometimes cause confusion when markers are very close together, and their rectangular areas overlap).
There's also a little blurb here about font-based markers:
Using the fonts and markers you provided, I noticed the circles/dots are off-line (to the left side) in the original RTF file but ok with the PDF version. But when I zoom it to 200% in the the RTF file, the markers are centered well, quite interesting….
I know 'albany amt' is one of the TrueType fonts for MS Word, but I don’t think it is one of the native hardware fonts for Post-script or PDF, is it? If I want to use the "Time-Roman" for PDF and "Courier New" for RTF, are there associated uicodes for the markers of dots and circles? Or I'm basically missing something here? When I tried to use "FONT="Times-Roman/unicode" VALUE='25cb'x", I saw strange symbols for markers in PDF. But using "FONT="Courier New/unicode" VALUE='25cf'x" is ok in RTF file.
Would appreciate more info on font based uni-codes for markers.
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.