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

Hi there,

 

I was trying to create a forest plot.

However the leading space was removed in the figure.

Anyone can help? Thanks!

 

Here is a small part of my figure:

Coooooo_Lee_3-1647875500508.png

 

The first column is aligned at left, but it does have blank in my dataset like

Coooooo_Lee_2-1647875000300.png

 

here is the first part of my GTL code to define the first column:

proc template;  
  DEFINE STATGRAPH Forest;

	begingraph;
	  layout lattice /columns=4 columnweights=(0.27 0.15 0.15 0.43);

		/*First column*/
    layout overlay / walldisplay=none xaxisopts=(display=none)
		  yaxisopts=(reverse=true display=none);
		  axistable y=obs value=txt / display=(values);
		endlayout;

 

I also tried to use "A0"x  to replace the space with non blank space, however the value was trancated at some place.

Coooooo_Lee_4-1647875706874.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
JeffMeyers
Barite | Level 11

Hello,

     A number of SAS graph statements automatically clear leading and trailing blanks.  You would have better luck adding another variable with the number of indents you would want and use the INDENT and INDENTWEIGHT options to get what you are looking for.

 

Also, shameless plug to my forest plot making macro:

https://communities.sas.com/t5/SAS-Communities-Library/MVMODELS-a-Macro-for-Survival-and-Logistic-An...

 

View solution in original post

2 REPLIES 2
ballardw
Super User

It looks like the INDENT option with INDENTWEIGHT may accomplish what you want. The Indentweight would be an expression to calculate a multiple of the indent amount for each value.

If that doesn't work you could try replacing the spaces with NULL characters, ASCII-255.

 

Many SAS procedures will display text justified to the left ignoring the more traditional "blank" space such as the space or tab character. The null character sometimes gets around that. You want to very carefully comment that is what you are doing as the code will not be obvious to anyone when you use this character.

JeffMeyers
Barite | Level 11

Hello,

     A number of SAS graph statements automatically clear leading and trailing blanks.  You would have better luck adding another variable with the number of indents you would want and use the INDENT and INDENTWEIGHT options to get what you are looking for.

 

Also, shameless plug to my forest plot making macro:

https://communities.sas.com/t5/SAS-Communities-Library/MVMODELS-a-Macro-for-Survival-and-Logistic-An...

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 418 views
  • 1 like
  • 3 in conversation