I want the chart to be visible in an HTML page, but only get a tiny icon in the upper left corner in the HTML file, labeled "The SGPANEL Procedure". I'm on Linux, SAS 9.4 TS1M3.
My code:
ods html file="&outdir/&sgplot_report_file";
*********************************************************;
* Plot quantities by categories;
*********************************************************;
title "&wfs_csv_file";
title2 height=7pt "%sysfunc(today(),date9.), %sysfunc(time(),hhmm5.)";
proc sgpanel data=work.sgplot_prep;
label orig_face = "Orig Face"
holding = "Holding";
panelby agency / columns=3;
rowaxis values=(-20000 to 20000 by 5000)
tickvalueformat=comma7.
offsetmin=0.05
offsetmax=0.05
valueshint
label="$Million";
vbar security_type /response = orig_face;
vbar security_type /response = holding transparency=0.50;
run;
ods html close;
ods html5 file="&outdir/&sgplot_report_file";
*********************************************************;
* Plot quantities by categories;
*********************************************************;
title "&wfs_csv_file";
title2 height=7pt "%sysfunc(today(),date9.), %sysfunc(time(),hhmm5.)";
proc sgpanel data=work.sgplot_prep;
label orig_face = "Orig Face"
holding = "Holding";
panelby agency / columns=3;
rowaxis values=(-20000 to 20000 by 5000)
tickvalueformat=comma7.
offsetmin=0.05
offsetmax=0.05
valueshint
label="$Million";
vbar security_type /response = orig_face;
vbar security_type /response = holding transparency=0.50;
run;
ods html5 close;
Does this work?
Try HTML5 instead?I'm fairly certain that embeds the images.
In HTML files images are stored somewhere else and reference, if you check the log it may indicate where, but you can also specify the path in the ODS HTML statements or make sure you keep the file and the images together.
HTML5 is a much quicker fix 🙂
@DougZ wrote:
I want the chart to be visible in an HTML page, but only get a tiny icon in the upper left corner in the HTML file, labeled "The SGPANEL Procedure". I'm on Linux, SAS 9.4 TS1M3.
My code:
ods html file="&outdir/&sgplot_report_file"; *********************************************************; * Plot quantities by categories; *********************************************************; title "&wfs_csv_file"; title2 height=7pt "%sysfunc(today(),date9.), %sysfunc(time(),hhmm5.)"; proc sgpanel data=work.sgplot_prep; label orig_face = "Orig Face" holding = "Holding"; panelby agency / columns=3; rowaxis values=(-20000 to 20000 by 5000) tickvalueformat=comma7. offsetmin=0.05 offsetmax=0.05 valueshint label="$Million"; vbar security_type /response = orig_face; vbar security_type /response = holding transparency=0.50; run; ods html close;
Reeza, how do I specify HTML5 for something like this?
ods html5 file="&outdir/&sgplot_report_file";
*********************************************************;
* Plot quantities by categories;
*********************************************************;
title "&wfs_csv_file";
title2 height=7pt "%sysfunc(today(),date9.), %sysfunc(time(),hhmm5.)";
proc sgpanel data=work.sgplot_prep;
label orig_face = "Orig Face"
holding = "Holding";
panelby agency / columns=3;
rowaxis values=(-20000 to 20000 by 5000)
tickvalueformat=comma7.
offsetmin=0.05
offsetmax=0.05
valueshint
label="$Million";
vbar security_type /response = orig_face;
vbar security_type /response = holding transparency=0.50;
run;
ods html5 close;
Does this work?
The problem is in your file specification. For HTML output, don't put the path in the FILE option. Also, you typically do not want the path to be written to the SRC option on the <img> tag, unless you are creating an directory structure for your HTML output. Therefore, I think this specification might work best for you:
ods html path="&outdir" (url=none) file="&sgplot_report_file";
Hope this helps!
Dan
Thanks Dan - just pasted your ods line into the code and ran, but got the same result.
Is the separate image being created?
Dan - a separate png file was created, but the HTML page had just the icon in the upper left and the label. However, I did combine both your ODS line suggestion and Reeza's HTML5 suggestion, and it works now! THANKS to you and Reeza.
For completeness, let me explain why HTML5 is working for you. By default in HTML5 output, ODS Graphics is generated as an inlined SVG output instead of an image (which can also be inlined with HTML5 using an option). Therefore, the separate PATH and (URL=NONE) had no effect on the graph output -- just on where the HTML file was written. I'm still curious as to why the other statement did not put the information in your SRC option of your <img> tag. Do you happen to still have that file around? If so, can you post the <img> tag so that I can see what was written in the SRC option?
Thanks!
Dan
Reeza - pls see my message to Dan... your suggestion + his suggestion together worked. THANK YOU!
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.