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

Like many, I have data with an outlier. I want a lattice columnaxes with ranges 0-240, 300-340 with a break character. I am unable to specify, since it requires tickvalues.

Can someone guide me? Thank you.

Stan

 

proc template;

definestatgraph Fig_5_4_3;

  dynamic VAR VARLABEL;

  begingraph;

entrytitle "&year Widget Contracts ($/unit)" ;

layout lattice / columndatarange=union rowweights=PREFERRED

columndatarange=union rowgutter=2px;

columnaxes;

columnaxis / display=(ticks tickvalues)

label=VARLABEL

labelattrs=(size=10)

linearopts=(tickvalueformat=dollar4. viewmax=340

tickvaluelist=(0 20 40 60 80 100 120 140 160 180 200 220 300 320 340) ) ;

endcolumnaxes;

layout overlay /yaxisopts=(griddisplay=on);

histogram PayerCF / nbins=40 binaxis=false;

densityplot PayerCF / lineattrs=graphfit name='n' legendlabel='Normal';

layoutgridded /columns=2 border=TRUE autoalign=(TopRight);

  entry halign=left "N";

          entry halign=left eval(strip(put(n(VAR),comma6.)));

          entry halign=left "Mean";

          entry halign=left eval(strip(put(mean(VAR),dollar6.2)));

        entry halign=left "Median";

         entry halign=left eval(strip(put(median(VAR),dollar6.2)));

endlayout;

endlayout;

layout overlay / yaxisopts=(griddisplay=on);

boxplot y=PayerCF /orient=horizontal /* boxwidth=.8 */

meanattrs=(color=navy size=10 symbol=diamondfilled)

dataskin=GLOSS

display=(CAPS FILL MEAN MEDIAN )

extreme=true ;

endlayout;

  endlayout;

endgraph;

end;

run;

Figure 16.png

1 ACCEPTED SOLUTION

Accepted Solutions
SSTEAD
Obsidian | Level 7

The solution is to NOT define the column axis within layout lattice. Rather, define it exactly the same for both lattice overlays. I turned the display=NONE option for the histogram.

 

proc template;
define statgraph Fig_5_4_3;
dynamic VAR VARLABEL;
begingraph /DesignWidth=650px;
entrytitle "&year Widget Contracts ($/unit)" ;
layout lattice / columndatarange=union rowweights=(0.8 0.2)
columndatarange=union rowgutter=2px;
layout overlay /yaxisopts=(griddisplay=on)
xaxisopts=(display=NONE linearopts=(includeranges=(0-220 310-330) ) ) ;
histogram PayerCF / nbins=40 binaxis=false;
densityplot PayerCF / lineattrs=graphfit name='n' legendlabel='Normal';

layout gridded /columns=2 border=TRUE autoalign=(TopLeft);
entry halign=left "N";
entry halign=left eval(strip(put(n(VAR),comma6.)));
entry halign=left "Mean";
entry halign=left eval(strip(put(mean(VAR),dollar6.2)));
entry halign=left "Median";
entry halign=left eval(strip(put(median(VAR),dollar6.2)));
endlayout;
endlayout;
layout overlay / yaxisopts=(griddisplay=on)
xaxisopts=(display=(LINE TICKS TICKVALUES)
linearopts=(includeranges=(0-220 310-330) tickvalueformat=dollar4.
tickvaluelist=(0 20 40 60 80 100 120 140 160 180 200 220 320)
) ) ;
boxplot y=PayerCF /orient=horizontal
meanattrs=(color=navy size=10 symbol=diamondfilled)
dataskin=GLOSS
display=(CAPS FILL MEAN MEDIAN )
extreme=true ;
endlayout;
endlayout;
endgraph;
end;
run;

 

Untitled 7.png

View solution in original post

1 REPLY 1
SSTEAD
Obsidian | Level 7

The solution is to NOT define the column axis within layout lattice. Rather, define it exactly the same for both lattice overlays. I turned the display=NONE option for the histogram.

 

proc template;
define statgraph Fig_5_4_3;
dynamic VAR VARLABEL;
begingraph /DesignWidth=650px;
entrytitle "&year Widget Contracts ($/unit)" ;
layout lattice / columndatarange=union rowweights=(0.8 0.2)
columndatarange=union rowgutter=2px;
layout overlay /yaxisopts=(griddisplay=on)
xaxisopts=(display=NONE linearopts=(includeranges=(0-220 310-330) ) ) ;
histogram PayerCF / nbins=40 binaxis=false;
densityplot PayerCF / lineattrs=graphfit name='n' legendlabel='Normal';

layout gridded /columns=2 border=TRUE autoalign=(TopLeft);
entry halign=left "N";
entry halign=left eval(strip(put(n(VAR),comma6.)));
entry halign=left "Mean";
entry halign=left eval(strip(put(mean(VAR),dollar6.2)));
entry halign=left "Median";
entry halign=left eval(strip(put(median(VAR),dollar6.2)));
endlayout;
endlayout;
layout overlay / yaxisopts=(griddisplay=on)
xaxisopts=(display=(LINE TICKS TICKVALUES)
linearopts=(includeranges=(0-220 310-330) tickvalueformat=dollar4.
tickvaluelist=(0 20 40 60 80 100 120 140 160 180 200 220 320)
) ) ;
boxplot y=PayerCF /orient=horizontal
meanattrs=(color=navy size=10 symbol=diamondfilled)
dataskin=GLOSS
display=(CAPS FILL MEAN MEDIAN )
extreme=true ;
endlayout;
endlayout;
endgraph;
end;
run;

 

Untitled 7.png

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 2195 views
  • 0 likes
  • 1 in conversation