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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1316 views
  • 0 likes
  • 1 in conversation