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

Dear Experts,

This is a questions with regard to the x axis labels i want to put in the graph where there is scatter plot and box plot jiterred.

i have written the following code

data class;

  set sashelp.class;

  age2=age-0.2;

run;

proc format fmtlib ;

value ns 10-11='1'

         11<-12='2'

         12<-13='3'

         13<-14='4'

         14<-15='5'

         15<-16='6'

;

run;

proc template ;

define statgraph scatterbox ;

begingraph ;

layout overlay / xaxisopts=(linearopts=(VIEWMIN=10 tickvaluesequence=(start=10 end=16 increment=1)));

boxplot x=age y=height / xaxis=x ;

scatterplot x=age2 y=height / xaxis=x ;

endlayout;

endgraph;

end ;

proc sgrender data=class template=scatterbox ;

format age  ns.;

run ;

the graph generated is as below

The scatter plot and box plot are aligned side by side. However the issue i have is with the x axis label, i should assign the label as shown in blue and that label should be between the scatter plot and box plot as labelled.

could you please help me to get it.

Thanks,

Jag

Thanks,
Jag
1 ACCEPTED SOLUTION

Accepted Solutions
Jay54
Meteorite | Level 14

Please ALWAYS include the release of SAS you are running.  Thanks for including the full program with data.

If you are running SAS 9.3 or later, you can user DiscreteOffset to place a scatter and a box side by side using GTL.  You can use the same variable for X or Category, The variable can be either discrete or a numeric column with a format.

View solution in original post

2 REPLIES 2
Jay54
Meteorite | Level 14

Please ALWAYS include the release of SAS you are running.  Thanks for including the full program with data.

If you are running SAS 9.3 or later, you can user DiscreteOffset to place a scatter and a box side by side using GTL.  You can use the same variable for X or Category, The variable can be either discrete or a numeric column with a format.

Jagadishkatam
Amethyst | Level 16

Thank you Sanjay! it worked.

i am working on sas 9.3.

Regards,

Jag

Thanks,
Jag

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2170 views
  • 0 likes
  • 2 in conversation