Hi,
I have a stored process wich produces a lot different kind of charts / maps etc.
I wanted to increase the resolution of the png images in the HTML output so I modified the html dpi option with this :
ods html
image_dpi=400
device=png
;
It works good with ODS graphics : i.e. dpi is increased but the width and height of the image in html is not changed
<img alt="The SGPlot Procedure" src="/SASStoredProcess/guest?_sessionid=2C07BCBA-F2C7-419B-B89B-72B2289BFE69&_program=replay&_entry=APSWO..." style=" height: 480px; width: 640px;" border="0" class="c">
With SAS/GRAPH (pie charts, maps in my case), the DPI is increase but also the HTML height and width
<img alt="Pie chart of Pathogen" src="/SASStoredProcess/guest?_sessionid=28DB6ECF-0A2B-485C-8F82-5AF78E0C6668&_program=replay&_entry=APSWO..." style=" border-width: 0px; height: 2500px; width: 3333px;" border="0" class="c graph">
Is there a way to control the width and height in this HTML file?
Maybe in the style?
Thank you for your help!
Here are some clues that might be of importance:
I'm using SAS 9.3 in Enterprise Guide 5.1
Solution :
proc odstext;
p "<script>
setTimeout(function(){
var el = document.getElementsByClassName('c graph')[0];
el.style.height = '';
el.style.width = '70%';
}, 0);
</script>";
run;
Will goptions xpixels/yxixels work?
goptions xpixels=200 ypixels=200;
Mathias - could you re-state your question? Are you trying to change the size of your ods graphics (such as sgplot), or are you trying to change the resolution of your SAS/Graph (such as gmap, gplot, gchart, etc)?
Also, could you show all the code you're currently using to try to control the size & resolution of both kinds of graphs. Note that SAS/Graph and ODS Graphics are different in how they control these things ... and when you're using html output with dev=png and sas/graph procs, I don't think you can control the resolution of those.
@Darell
This produces a 200x200px png image displayed at 200x200px
goptions modifies the PNG image size. I would like to keep the same png image size, only change it's display size in html style.
@RobertAllisson
> could you re-state your question?
I'll try my best:
Lets say that I produce 2 plots in my STP : an SGPLOT (ODS graphics) and a PROC GMAP (SAS/GRAPH).
When I declare
ods html image_dpi=400 ;
It changes the png sizes for both the graphs
- the sgplot png image is: 2666x2000
- the map png image is: 3333x2500
That's very good, it's exactly what I want.
The difference lays in the HTML style :
- the sgplot html img tag style is: 640x480
- the map html img tag style is: 3333x2500
(cf. complete img tags in my first post)
I prefer 640x480, which is more visible in my web browser.
Thus I'm looking for a method to change the SAS/GRAPH html img tag style width & height
> Are you trying to change the size of your ods graphics (such as sgplot), or are you trying to change the resolution of your SAS/Graph (such as gmap, gplot, gchart, etc)?
Only the HTML style width & height
> Also, could you show all the code you're currently using to try to control the size & resolution
%let _ODSDEST = html ;
%let _ODSSTYLE = wivisp1 ;
%let _ODSSTYLESHEET = ;
%let _GOPT_DEVICE=png;
ods html image_dpi=400 device=png ;
That's It I believe.
Many thanks !
Any solutions?
Solution :
proc odstext;
p "<script>
setTimeout(function(){
var el = document.getElementsByClassName('c graph')[0];
el.style.height = '';
el.style.width = '70%';
}, 0);
</script>";
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.