BookmarkSubscribeRSS Feed
ampatella
Calcite | Level 5

Hello,

Is it possible to create a break in the x-axis with the range following the break at a different distribution/scale than the data prior to the break? For example, prior to the break the x-axis ranges from 0 to 11 by 1, taking up the majority of the graph space. After the break at 11, the range is from 11-16 by 1, but more condensed, only occupying the last 10% or so of the graph. (Most data to display occurs prior to x=11.) I've attached a screenshot of the desired x-axis with the break and proper distributions prior to and after the break.

 

Screenshot 2025-11-24 074129.png

 

Thanks so much in advance!

2 REPLIES 2
BrunoMueller
SAS Super FREQ

As a start have a look here https://blogs.sas.com/content/graphicallyspeaking/2012/05/31/broken-y-axis/ it provides a code sample that does the break of an axis "manually". You will have to use the GTL (Graph Template Language). I have taken the above example and adapted it for a broken X axis. Since you did not provide any data and what kind of plot you want I assumed something.

 

See this sample:

data plotdata;
  do month = 1 to 14;
    value = rand("integer", 10, 20);
    output;
  end;
run;

/*-- manual break in axis --*/
proc template;
  define statgraph series_break;
    begingraph;
      /* the columweights determine the space available */
      layout lattice / columns=2 rowdatarange=union columnweights=(0.9 0.1) ;
        layout overlay / 
          xaxisopts=(
            griddisplay=on display=(ticks tickvalues label) 
            tickvalueattrs=(size=7)
             linearopts=(viewmin=1 viewmax=11 TICKVALUELIST=(1 2 3 4 5 6 7 8 9 10))
             offsetmax=0
          );
          seriesplot x=month y=value;
        endlayout;
        layout overlay / 
          xaxisopts=(
            griddisplay=on display=(ticks tickvalues) 
            tickvalueattrs=(size=7)
            linearopts=(viewmin=11 TICKVALUELIST=(11 12 13 14))
            offsetmin=0
          )
          yaxisopts=( display=none)
        ;
          seriesplot x=month y=value;
        endlayout;
      endlayout;
    endgraph;
  end;
run;

ods graphics / reset=all;

proc sgrender data=plotdata template=series_break;
run;

 

Ksharp
Super User

Or using X2AXIS statement.

data plotdata;
  do month = 1 to 14;
    if month<11 then month1=month;
	 else do;month1=.;month2=month;end;
    value = rand("integer", 10, 20);
    output;
  end;
run;

proc sgplot data=plotdata noautolegend;
series x=month1 y=value;
series x=month2 y=value/x2axis;
xaxis offsetmax=0.2 integer values=(1 to 10 by 1);
x2axis offsetmin=0.8;
run;

Ksharp_1-1764064177390.png

 

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

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
  • 2 replies
  • 365 views
  • 7 likes
  • 3 in conversation