BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bberg
Calcite | Level 5

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!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

5 REPLIES 5
GraphGuy
Meteorite | Level 14

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)

bberg
Calcite | Level 5

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.

ballardw
Super User

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.

bberg
Calcite | Level 5

Thank you!!!  I definitely wasn't anticipating such a simple solution. 🙂

Jay54
Meteorite | Level 14

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).

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 989 views
  • 0 likes
  • 4 in conversation