BookmarkSubscribeRSS Feed
tmlee02
Fluorite | Level 6

Hello, 

 

I'm having trouble getting the labels to appear on the X-axis. I already have a format in SAS for Var2. When I run the code below, there are no labels on the X-axis. I would like the x-axis to display the values of Var2 and tick marks at A, B, C, D, and E. I have tried running this with and without the FORMAT and VALUESFORMAT statements and it is the same outcome. Any tips would be appreciated! Thanks!


PROC SGPLOT DATA = newdata NOAUTOLEGEND;
FORMAT Var2 $Var2.;
VBOX Var1 /GROUP = Var2 ;

XAXIS VALUES = ("A" "B" "C" "D" "E")
VALUESFORMAT= $Var2.

YAXIS VALUES = ( 0 TO 100 BY 10 );
RUN;

4 REPLIES 4
PGStats
Opal | Level 21

Try using CATEGORY instead of GROUP:

 

PROC SGPLOT DATA = newdata NOAUTOLEGEND;
FORMAT Var2 $Var2.;
VBOX Var1 / CATEGORY = Var2 ;
XAXIS VALUES = ("A" "B" "C" "D" "E")
VALUESFORMAT= $Var2.;
YAXIS VALUES = ( 0 TO 100 BY 10 );
RUN;
PG
tmlee02
Fluorite | Level 6

Hi, 

 

Thanks for your help. I put in CATEGORY and this did add the label to the x-axis. However, it only displays one of my categorical variables ("A") instead of displaying A, B, C, D, and E. Any thoughts on why that might be?

 

Thanks!

ballardw
Super User

@tmlee02 wrote:

Hi, 

 

Thanks for your help. I put in CATEGORY and this did add the label to the x-axis. However, it only displays one of my categorical variables ("A") instead of displaying A, B, C, D, and E. Any thoughts on why that might be?

 

Thanks!


Definition of your custom format?

Data values?

Interaction between the two.

PGStats
Opal | Level 21

Try removing the XAXIS statement altogether. Begin from a simpler starting point.

PG

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 893 views
  • 0 likes
  • 3 in conversation