BookmarkSubscribeRSS Feed
vstorme
Obsidian | Level 7

Dear community,

 

Currently I have the following (as an example) working code:

ods noproctitle;

ods html5 style=opal path= "/data/temp" (url=none) body = 'test2_body.htm' frame = 'test2_web.htm' page = 'test2_pagecontent.htm' newfile=page options(svg_mode="inline"); ods graphics on / reset=all scale=off imagemap=on outputfmt=svg ; options svgheight="50%" svgwidth="75%" ; ods proclabel "weight vs height for male students"; title j=c "weight vs height for male students"; proc sgplot data = sashelp.class description =' ' noopaque; scatter x=weight y=height; where sex='M'; run; ods proclabel "weight vs height for female students"; title j=c "weight vs height for female students"; proc sgplot data = sashelp.class description =' ' noopaque; scatter x=weight y=height; where sex='F'; run; ods proclabel "boxplots weight"; title j=c "boxplots weight"; proc sgplot data = sashelp.class description =' ' noopaque; vbox weight / category = sex ; run; ods proclabel "boxplots height"; title j=c "boxplots height"; proc sgplot data = sashelp.class description =' ' noopaque; vbox height / category = sex ; run; ods html5 close;

This creates one plot per page with a page content sidebar which I like. I would however now want to have per page 2 side by side plots. I tried with ods layout gridded and ods region, however, this does not give the expected results. Did somebody try this? It does work without the newfile=page option and without the page content, but that is not what I want.

with kind regards,

Veronique

1 REPLY 1
vstorme
Obsidian | Level 7

I managed to upgrade the result a little by using contents instead of page and adding some text in between. However, by using outputfmt=svg, the image size should adapt to the screen used (large screen, laptop screen,...) but this seems not to be the case.

ods noproctitle;

* with ods graphics / imagefmt=svg the contents will resize to 
 the size of the browser container  ;

ods html5 style=opal
          path= "/data/temp" (url=none)
          body = 'test_body.htm'
          contents = 'test_contents.htm' /*creates toc*/
          frame = 'test_web.htm'
          /*page = 'test_pagecontent.htm' newfile=page*/
          options(svg_mode="inline");

/* setup the graphs */
ods graphics on / reset=all scale=off 
                  imagefmt=SVG outputfmt=svg
                  imagemap=on; /* needed for data tips */


ods html5 text= '<h1>Scatter Plots</h1>' ;

ods layout gridded rows=1 columns=2 
  column_gutter=20px;

ods region row=1 column=1;

ods
ods proclabel "weight vs height for male students";
title j=c "weight vs height for male students";
proc sgplot data = sashelp.class description =' ' noopaque;
scatter x=weight y=height;
where sex='M';
run;

ods region row=1 column=2;

ods proclabel "weight vs height for female students";
title j=c "weight vs height for female students";
proc sgplot data = sashelp.class description =' ' noopaque;
scatter x=weight y=height;
where sex='F';
run;

ods layout end;

ods html5 text = '<br>' ;
ods html5 text = '<hr>' ;
ods html5 text = '<br>' ;

******************************************;

ods html5 text= '<h1>Boxplots</h1>' ;

ods layout gridded rows=1 columns=2 
  column_gutter=20px;

ods region row=1 column=1;

ods proclabel "boxplots weight";
title j=c "boxplots weight";
proc sgplot data = sashelp.class description =' ' noopaque;
vbox weight / category = sex ;
run;

ods region row=1 column=2;

ods proclabel "boxplots height";
title j=c "boxplots height";
proc sgplot data = sashelp.class description =' ' noopaque;
vbox height / category = sex ;
run;


ods layout end;
ods html5 close;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of 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
  • 1 reply
  • 553 views
  • 0 likes
  • 1 in conversation