Data visualization with SAS programming

Wrap SGPANEL Column Headers (9.3)

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

Wrap SGPANEL Column Headers (9.3)

I am creating a panel plot using SGPANEL with v 9.3 and some of the column headers are too long to fit in the column header box.

Instead of wrapping or shrinking the text, the column header names are truncated to fit in the box (in the attached example the column header "A Name That Is Too Long To Fit" is truncated to "A Name That Is Too Lo".

Is there a way to split these names to two lines or any other solution?

 

An additional question about the order of the panels: I have the data sorted with the variable study in a different order than it appears in the plot:

The left panel should be "A Short Name", the next panel "A Longer Name", ..., the right panel "A Name That is Too Long To Fit".

But when SAS makes the graph it sorts the study variable alphabetically and then places the panels in that order.

Is there any way to fix this?

 

 

Here is the code I am using:

proc sgpanel data=raw noautolegend;
panelby study / layout=columnlattice columns = 4
onepanel /*noborder*/ colheaderpos=top novarname;
vbox result / group=entry grouporder = data;
colaxis discreteorder = data;
run; quit;

 

 


Accepted Solutions
Solution
‎11-27-2017 11:20 AM
SAS Super FREQ
Posts: 1,047

Re: Wrap SGPANEL Column Headers (9.3)

Posted in reply to shahparth260

For the second part, we added a SORTORDER option on the PANELBY statement in SAS 9.4 to handle panel sorting needs. However, for 9.3, the  best way to handle this is to do the following:

 

1. Create a column to assign numbers to the string values in the order you want them.

2. Create a user-defined format to turn those numbers back into the string values.

3. Use this column as your PANELBY variable instead of the original string column.

 

Hope this helps!

Dan 

View solution in original post


All Replies
Occasional Contributor
Posts: 14

Re: Wrap SGPANEL Column Headers (9.3)

Hello, 

Contributor 

I've the first answer for your question. 

you can update your code  :

 

COLAXIS min= -50 max= 200 valueattrs=(size=10) labelattrs=(size=10) ;

change your labelattrs size accroding to your label 

 

Thanks .

 

 

 

PS
Solution
‎11-27-2017 11:20 AM
SAS Super FREQ
Posts: 1,047

Re: Wrap SGPANEL Column Headers (9.3)

Posted in reply to shahparth260

For the second part, we added a SORTORDER option on the PANELBY statement in SAS 9.4 to handle panel sorting needs. However, for 9.3, the  best way to handle this is to do the following:

 

1. Create a column to assign numbers to the string values in the order you want them.

2. Create a user-defined format to turn those numbers back into the string values.

3. Use this column as your PANELBY variable instead of the original string column.

 

Hope this helps!

Dan 

Occasional Contributor
Posts: 14

Re: Wrap SGPANEL Column Headers (9.3)

Hi,
Dan

I appreciate for the second part.Thanks for sharing depth knowledge on the SGPANEL and time as well. This is really good information. Smiley Happy

Good day !


PS
Contributor
Posts: 30

Re: Wrap SGPANEL Column Headers (9.3)

Posted in reply to shahparth260

Thank you so much shahparth260 and Dan for your replies to my question; I can now create the plot that I need with this information!

Occasional Contributor
Posts: 14

Re: Wrap SGPANEL Column Headers (9.3)

No problem at all ...fastb.
PS
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 242 views
  • 1 like
  • 3 in conversation