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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1790 views
  • 0 likes
  • 3 in conversation