Thanks, for the code. Do I have problem with this code if the data sources for the plots are not same. I also need to include a by variable in the boxplot. In addition, I got the following message in the log:
1143 proc template;
1144 define statgraph boxscatter;
ERROR 180-322: Statement is not valid or it is used out of proper order.
1146 layout overlay;
1147 boxplot x=age y=height;
1148 scatterplot x=age y=weight / yaxis=y2;
WARNING 1-322: Assuming the symbol END was misspelled as endgraph.
WARNING: Object will not be saved.
NOTE: PROCEDURE TEMPLATE used (Total process time):
real time 0.21 seconds
cpu time 0.00 seconds
WARNING: Errors were produced.
NOTE: The SAS System stopped processing this step because of errors.
Here's how with good-old traditional gplot (the example generates some fake/random data, and also plots it)...
Assuming you're using the same data for the boxplot and the scatter plot (ie, you just want to also show a scatter plot of the points that the boxplot is based on), this can be very easily done by putting the y*x on the plot statement twice, and using a different plot interpolation for each:
do x=0 to 10 by 1;
do i=1 to 20;
Based on your log output, you must not have SAS 9.2. Robert's gplot approach should work fine for you. As a side note, the SGRENDER procedure does support BY-groups. The BY-group variable(s) is not specified in the template.