BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GeorgeSAS
Lapis Lazuli | Level 10

Hello everyone,

 

I have a gplot like this:

proc sgplot data=sashelp.electric(
     where=(customer="Residential"));
  xaxis type=discrete;
  series x=year y=coal;
  series x=year y=naturalgas / y2axis;
run;

But there are too many value one the x-axis,(this exaple only 1994--2005, but in my data there is much more),

my question is how to reduce the size of the labels?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13

The second step shows a literal answer to your question.  The first shows what I think is a better answer.  Do you really want a discrete axis with years?  Why not a linear axis?

 

proc sgplot data=sashelp.electric(
     where=(customer="Residential"));
  xaxis integer;
  series x=year y=coal;
  series x=year y=naturalgas / y2axis;
run;

proc sgplot data=sashelp.electric(
     where=(customer="Residential"));
  xaxis type=discrete valueattrs=(size=6);
  series x=year y=coal;
  series x=year y=naturalgas / y2axis;
run;

View solution in original post

1 REPLY 1
WarrenKuhfeld
Ammonite | Level 13

The second step shows a literal answer to your question.  The first shows what I think is a better answer.  Do you really want a discrete axis with years?  Why not a linear axis?

 

proc sgplot data=sashelp.electric(
     where=(customer="Residential"));
  xaxis integer;
  series x=year y=coal;
  series x=year y=naturalgas / y2axis;
run;

proc sgplot data=sashelp.electric(
     where=(customer="Residential"));
  xaxis type=discrete valueattrs=(size=6);
  series x=year y=coal;
  series x=year y=naturalgas / y2axis;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1380 views
  • 1 like
  • 2 in conversation