- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to create a "caterpillar plot" using ODS PDF. The X variable is 1 long character variable, consisting of several concatenated variables. In the basic SAS output, the concatenated variables (within the larger X variable) are aligned just how I want them, but they lose that alignment in the PDF output. The alignment ia also off in the ODS HTML output - it looks like extra spaces (which I need to retain) are being removed between the concatenated variables. Does anyone know what could cause the extra spaces to be removed in ODS?
I'm relatively new to modifying this type of graph output in SAS, so I'd appreciate any help!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Font
The traditional output is using SAS Monospace. The HTM and PDF are using proportional fonts. You will need to use a style for HTML and PDF that use a non-proportional font to align as you would like. You may need to make a custom style using Courier or something similar. At least that's a start.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Which proc are you using?
Can you post an example (maybe a screen-capture) of the output you're seeing?
(the good output, and the bad output)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sure - see attached.
Basic SAS output – This is the alignment I want. I’ve formatted the concatenated variables so that hospital name is left-aligned and the numbers are right-aligned. The sum of the lengths of the concatenated variables (plus spaces between) is exactly the length of the new “hosnamenew” variable.
ODS HTML output after a simple proc print – The intervening spaces appear to be removed, and the variable is now left-aligned.
ODS PDF output after proc template and proc sgrender – Some of the intervening spaces are now removed, and the variable appears to be right-aligned. Differing lengths in the 5th column are causing misalignment to the left, even though the formatting of “hosnamenew” hasn’t changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Font
The traditional output is using SAS Monospace. The HTM and PDF are using proportional fonts. You will need to use a style for HTML and PDF that use a non-proportional font to align as you would like. You may need to make a custom style using Courier or something similar. At least that's a start.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you!!! I definitely wasn't anticipating such a simple solution. 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This looks like a Forest plot. Here is an example using the SGPLOT procedure. You can place the columns on left or right. In general, you can align columns of data with the discrete axis. If you want a "bar" like entity, use VbarParm or HighLow plot (9.3) or Needle Plot (9.2).