The SAS Output Delivery System and reporting techniques

Creating HTML files via ODS in EG vs EM

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Creating HTML files via ODS in EG vs EM

Hi All,

 

So there are some custom graphs i want to create after I have built a model in EM. 

 

I made code that generates HTML files of those graphs for me. Because there are multiple graphs created, I use a frame file that has links to multiple pages of graphs.

 

I use the following code ot define my ods output ( i will include full code later ):

 

%let file_nm=variable_dive;
%let file_type=html;
%let folder = data_dive;

libname emwork22 base '/data/bi/data/sasdata/modelling/Model_Development/Factory_Rebuild/Workspaces/EMWS22';

%let stat_worth = EMWORK22.STAT_worth;
%let stat_class = EMWORK22.STAT_CLASS;
%let effects = emwork22.reg2_effects;

%let file_type = html;

ods &file_type. 
	body="&file_nm._body.&file_type."
	contents = "&file_nm._contents.&file_type."
	frame = "&file_nm._frame.&file_type."
	page = "&file_nm._page.&file_type."
	newfile=page
	style=htmlblue
	path="/data/bi/data/sasdata/modelling/Model_Development/Factory_Rebuild/Workspaces/EMWS22/EMCODE4/em_test/" (url=none)
	gpath="/data/bi/data/sasdata/modelling/Model_Development/Factory_Rebuild/Workspaces/EMWS22/EMCODE4/em_test/" (url=none);


/* code to make graphs */

ods &file_type.  select all;
ods &file_type.  show;
ods &file_type.  close;



 

And it poroduces output like so:

 

html_file.PNG

 

So this was created from SAS EG ( and is exactly what I want), in order to accomodate the multiple pages the html ods procedure creates multiple body files like so:

 

file_list_eg.PNG

 

However when I run litteraly the exact same code from SAS EM ( in a sas code node), it only creates 1 body file, and the frame is empty:

 

em_hmtl_file.PNG

 

List of files created by EM:

 

file_list_em.PNG

 

I guess my question is why is this different, and is there something I can do to force the same outcome?

 

Thanks for the help.

 

I am running SAS Depot 9.4 M2, SAS EG 6.1 SAS EM 13.1

 

Full Code:

Spoiler
%let file_nm=variable_dive;
%let file_type=html;
%let folder = data_dive;

libname emwork22 base '/data/bi/data/sasdata/modelling/Model_Development/Factory_Rebuild/Workspaces/EMWS22';

%let stat_worth = EMWORK22.STAT_worth;
%let stat_class = EMWORK22.STAT_CLASS;
%let effects = emwork22.reg2_effects;

%let file_type = html;

ods &file_type.
    body="&file_nm._body.&file_type."
    contents = "&file_nm._contents.&file_type."
    frame = "&file_nm._frame.&file_type."
    page = "&file_nm._page.&file_type."
    newfile=page
    style=htmlblue
    path="/data/bi/data/sasdata/modelling/Model_Development/Factory_Rebuild/Workspaces/EMWS22/EMCODE4/em_test/" (url=none)
    gpath="/data/bi/data/sasdata/modelling/Model_Development/Factory_Rebuild/Workspaces/EMWS22/EMCODE4/em_test/" (url=none);


proc sql;
    create table work.var_worth as
        select
            base.name as variable,
            base.label,
            base.rank,
            base.worth,
            100*base.worth/ttl.ttl_worth as percent_contribution
        from &stat_worth. as base

        cross join (
            select
                sum(worth) as ttl_worth
            from &stat_worth.
        ) as ttl
    ;
quit;


/* -------------------------------------------------------------------
   Code generated by SAS Task

   Generated on: Friday, August 19, 2016 at 2:16:39 PM
   By task: Bar Chart

   Input Data: BIApp_USER:WORK.VAR_WORTH
   Server:  BIApp_USER
   ------------------------------------------------------------------- */


/* -------------------------------------------------------------------
   Sort data set BIApp_USER:WORK.VAR_WORTH
   ------------------------------------------------------------------- */

PROC SQL;
    CREATE VIEW WORK.SORTTempTableSorted AS
        SELECT T.LABEL, T.percent_contribution
    FROM WORK.VAR_WORTH as T
;
QUIT;
Axis1
    STYLE=1
    WIDTH=1


;
Axis2
    STYLE=1
    WIDTH=1
    MINOR=NONE


;
TITLE;
TITLE1 "Variable Worth";
FOOTNOTE;
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
PROC GCHART DATA=WORK.SORTTempTableSorted
;
    HBAR
     LABEL
 /
    SUMVAR=percent_contribution
    Descending
    CLIPREF
FRAME    TYPE=SUM
    NOLEGEND
    COUTLINE=BLACK
    MAXIS=AXIS1
    RAXIS=AXIS2
PATTERNID=MIDPOINT
;
/* -------------------------------------------------------------------
   End of task code.
   ------------------------------------------------------------------- */
RUN; QUIT;

TITLE; FOOTNOTE;



proc sql;
    create table work.class_vars_raw as
        select
            base.*,
            base.event_count/(base.event_count+base.non_event_count) as target_rt,
            (base.event_count+base.non_event_count) as freq,
            100*(base.event_count+base.non_event_count)/ttl_tbl.num_subs as freq_rt,
            base.level_fix,
            eff_tbl.effect,
            eff_tbl.effectlabel,
            coalesce(eff_tbl.coefficient,0) as coefficient,
            eff_tbl.classlevel
        from (
            select
                variable,
                level,
                label,
                trim(prxchange("s/[^A-Za-z0-9]//",-1,trim(substr(level,1,32-length(variable))))) as level_fix,
                sum(
                    case
                        when targetvalue = '0'
                        then count
                    end
                ) as non_event_count,
                sum(
                    case
                        when targetvalue = '1'
                        then count
                    end
                ) as event_count

            from &stat_class.
                where role = 'INPUT'

                group by 1,2,3,4
        )as base

        left join(
            select
                variable,
                sum(count) as num_subs
            from &stat_class.
                group by 1
        ) as ttl_tbl
            on base.variable = ttl_tbl.variable

        left join (
            select
                variable,
                effect,
                trim(prxchange("s/[^A-Za-z0-9]//",-1,trim(classlevel))) as level_fix,
                effectlabel,
                coefficient,
                classlevel
            FROM &effects.
        )as eff_tbl
            on  eff_tbl.variable = base.variable
             and upcase(base.level_fix) = upcase(eff_tbl.level_fix)
    ;
quit;

proc sql;
    create table work.class_vars as
        select
            base.*,
            put(base.target_rt,percent10.2) as target_rate_label,
            base.target_rt/max_tgt as adj_tgt_rt,
            base.coefficient/max_coef as adj_coef,
            0 as zero_line
        from work.class_vars_raw as base

        left join (
            select
                variable,
                max(abs(target_rt)) as max_tgt,
                max(abs(coefficient)) as max_coef
            from work.class_vars_raw
                group by 1
        ) as max_tbl
            on base.variable = max_tbl.variable
    ;
quit;

/* -------------------------------------------------------------------
   Code generated by SAS Task

   Generated on: Thursday, August 18, 2016 at 3:25:05 PM
   By task: Bar-Line Chart

   Input Data: BIApp_USER:WORK.CLASS_VARS
   Server:  BIApp_USER
   ------------------------------------------------------------------- */


/* -------------------------------------------------------------------
   Sort data set BIApp_USER:WORK.CLASS_VARS
   ------------------------------------------------------------------- */

PROC SQL;
    CREATE VIEW WORK.SORTTempTableSorted AS
        SELECT T.LABEL, T.LEVEL, T.freq_rt, T.adj_coef, T.adj_tgt_rt, T.zero_line, T.target_rate_label, T.VARIABLE
    FROM WORK.CLASS_VARS as T
        order by t.label


;
QUIT;
SYMBOL3
    INTERPOL=JOIN

    HEIGHT=10pt
    VALUE=NONE
    CV=CX969696
    CO=CX969696
    LINE=4
    WIDTH=2
    CI=CX969696
;
SYMBOL2
    INTERPOL=JOIN

    HEIGHT=10pt
    VALUE=SQUARE
    LINE=1
    WIDTH=2

    CV = _STYLE_
;
SYMBOL1
    INTERPOL=JOIN

    HEIGHT=10pt
    VALUE=SQUARE
    LINE=1
    WIDTH=2

    CV = _STYLE_
;
Legend2
    FRAME
    ;
Legend1
    FRAME
    ;
Axis1
    STYLE=1
    WIDTH=1
    MINOR=NONE



;
Axis2
    STYLE=1
    WIDTH=1
    value=(angle=-45)


;
Axis3
    STYLE=1
    WIDTH=1
    MINOR=NONE
    major=NONE
    LABEL=NONE
    value=NONE


 ;
TITLE;
TITLE1 #BYVAL1;
FOOTNOTE;
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
options nobyline;
PROC GBARLINE DATA=WORK.SORTTempTableSorted
;
    BAR     LEVEL

 /
    SUMVAR=freq_rt
    SUBGROUP=target_rate_label
FRAME    TYPE=SUM
    MISSING
    COUTLINE=BLACK
    RAXIS=AXIS1
    MAXIS=AXIS2
    LEGEND=LEGEND2
;
    PLOT / SUMVAR=adj_coef
    TYPE=SUM
    AXIS=AXIS3
    LEGEND=LEGEND1
;
    PLOT / SUMVAR=adj_tgt_rt
    TYPE=SUM
    AXIS=AXIS3
;
    PLOT / SUMVAR=zero_line
    TYPE=SUM
    AXIS=AXIS3
;
    BY label;

/* -------------------------------------------------------------------
   End of task code.
   ------------------------------------------------------------------- */
RUN; QUIT;

TITLE; FOOTNOTE;
GOPTIONS RESET = SYMBOL;


ods &file_type.  select all;
ods &file_type.  show;
ods &file_type.  close;

Accepted Solutions
Solution
‎08-25-2016 02:05 PM
Occasional Contributor
Posts: 7

Re: Creating HTML files via ODS in EG vs EM

Figured it out, needed to add two lines before my ods definition:

 

ODS _ALL_ CLOSE;
OPTIONS DEV=ACTIVEX;

 

These lines are automatically run by EG, but not by EM.

View solution in original post


All Replies
Solution
‎08-25-2016 02:05 PM
Occasional Contributor
Posts: 7

Re: Creating HTML files via ODS in EG vs EM

Figured it out, needed to add two lines before my ods definition:

 

ODS _ALL_ CLOSE;
OPTIONS DEV=ACTIVEX;

 

These lines are automatically run by EG, but not by EM.

☑ This topic is SOLVED.

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

Discussion stats
  • 1 reply
  • 243 views
  • 1 like
  • 1 in conversation