Data visualization with SAS programming

How to get SGPANEL to write HTML output

Accepted Solution Solved
Reply
Highlighted
Contributor
Posts: 20
Accepted Solution

How to get SGPANEL to write HTML output

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;

 

 


Accepted Solutions
Solution
‎02-28-2018 03:44 PM
Super User
Posts: 23,700

Re: How to get SGPANEL to write HTML output

     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?

View solution in original post


All Replies
Super User
Posts: 23,700

Re: How to get SGPANEL to write HTML output

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 Smiley Happy

 


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;

 

 


 

 

Contributor
Posts: 20

Re: How to get SGPANEL to write HTML output

Reeza, how do I specify HTML5 for something like this?

Solution
‎02-28-2018 03:44 PM
Super User
Posts: 23,700

Re: How to get SGPANEL to write HTML output

     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?

SAS Super FREQ
Posts: 1,102

Re: How to get SGPANEL to write HTML output

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 

Contributor
Posts: 20

Re: How to get SGPANEL to write HTML output

sgpanel_msg.PNGThanks Dan - just pasted your ods line into the code and ran, but got the same result.

SAS Super FREQ
Posts: 1,102

Re: How to get SGPANEL to write HTML output

Is the separate image being created?

Contributor
Posts: 20

Re: How to get SGPANEL to write HTML output

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.Capture.PNG

SAS Super FREQ
Posts: 1,102

Re: How to get SGPANEL to write HTML output

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

Contributor
Posts: 20

Re: How to get SGPANEL to write HTML output

Reeza - pls see my message to Dan... your suggestion + his suggestion together worked.  THANK YOU!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 246 views
  • 8 likes
  • 3 in conversation