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

 

Hi,

 

 

As the subject indicates, my sas version is 9.2, so the fitpolicy option in the xaxis statment only have the following values: STAGGER,ROTATE,THIN and its combinations, without the split option.  Since my values for the axis is a little bit long , running the code below generates an ugly graph. I am wondering if there is any other possible way to display the values on the X axis in mutiline mode? Thanks!

 

 

proc sgplot data = Ind_stat; 
xaxis type = discrete label = "ind" fitpolicy = staggerrotate display = (noticks);
yaxis label = "# of Customers";
vbar hy/response = n datalabel;
run;

 

 


91694361635596462.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

One way with SGPLOT would be to use the HBAR statement instead of VBAR.  Then, the long category labels are displayed on the Y axis.  Better than slanted labels on the x-axis.

 

Another way would be to use GCHART procedure, and use the SplitChar option as shown in this example:  http://support.sas.com/kb/45/123.html

 

View solution in original post

5 REPLIES 5
Jay54
Meteorite | Level 14

There are not many options with SAS 9.2.  With SAS 9.3 you can use SGAnnotate to replace the tick values with split values.  With SAS 9.4, you can get split tick values from the procedure itself.

Wang_Yajun
Obsidian | Level 7

Hi, Sanjay

 

Only SAS 9.2 is available in my working computer, I am wondering if there is other potential options, thanks !

Jay54
Meteorite | Level 14

One way with SGPLOT would be to use the HBAR statement instead of VBAR.  Then, the long category labels are displayed on the Y axis.  Better than slanted labels on the x-axis.

 

Another way would be to use GCHART procedure, and use the SplitChar option as shown in this example:  http://support.sas.com/kb/45/123.html

 

Jay54
Meteorite | Level 14

Which solution did you prefer?

Wang_Yajun
Obsidian | Level 7

Hi, Sanjay

 

Using Hbar statement in SGPLOT looks a little bit better than VBar statement, but it still looks weird. PROC GCHART solves this problem prefectly in SAS 9.2, thanks for your input.

 

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1960 views
  • 1 like
  • 2 in conversation