78282219
78282219

Reputation: 105

SAS: Can you save the input table of a SAS generated bar-line chart?

So I am generating a SAS bar-line chart in SAS with a dataset which looks like this:

id date default var1 log_var1 square_var1 ... cubic_var1
1  1    1        5    -3.3     0.9             1.2
1  2    0        15   -9.9     2.7             3.6
2  1    1        10   -6.6     1.8             2.4
...

Note, the transformations are not

log(var1) 

but actually the transformation from the regression so

log_var1 = alpha + beta log(var1)

Now I use the following code, generated by the SAS task for bar-line chart:

SYMBOL1
    INTERPOL=JOIN

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

    CV = _STYLE_
;
SYMBOL2
    INTERPOL=JOIN

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

    CV = _STYLE_
;
SYMBOL3
    INTERPOL=JOIN

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

    CV = _STYLE_
;
SYMBOL4
    INTERPOL=JOIN

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

    CV = _STYLE_
;
SYMBOL5
    INTERPOL=JOIN

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

    CV = _STYLE_
;
SYMBOL6
    INTERPOL=JOIN

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

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


;
Axis2
    STYLE=1
    WIDTH=1


;
Axis3
    STYLE=1
    WIDTH=1
    MINOR=NONE


 ;
TITLE;
TITLE1 "Bar-Line Chart";
FOOTNOTE;
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
PROC GBARLINE DATA=WORK.SORTTempTableSorted
;
    BAR  var1
 /
FRAME   LEVELS=25
    COUTLINE=BLACK
    RAXIS=AXIS1
    MAXIS=AXIS2
    LEGEND=LEGEND2
;
    PLOT / SUMVAR=default
    TYPE=MEAN
    AXIS=AXIS3
    LEGEND=LEGEND1
;
    PLOT / SUMVAR=lin_var1
    TYPE=MEAN
    AXIS=AXIS3
;
    PLOT / SUMVAR=sigmoid_var1
    TYPE=MEAN
    AXIS=AXIS3
;
    PLOT / SUMVAR=square_var1
    TYPE=MEAN
    AXIS=AXIS3
;
    PLOT / SUMVAR=cubic_var1
    TYPE=MEAN
    AXIS=AXIS3
;
    PLOT / SUMVAR=log_var1
    TYPE=MEAN
    AXIS=AXIS3
;

/* -------------------------------------------------------------------
   End of task code
   ------------------------------------------------------------------- */
RUN; QUIT;
%_eg_conditional_dropds(WORK.SORTTempTableSorted);
TITLE; FOOTNOTE;
GOPTIONS RESET = SYMBOL;

My question is:

Can I somehow store or save the input to create this histogram? I.e. a table that contains the mean value for default, var1, square_var1, cubic_var1 for the 25 equally spaced bins?

The premise of doing this is that all the inputs are on different scales and so I'd like to standardise the inputs and then plot the graphs

Note: I can take the time to code up the binning myself but this would truly be a trick of a lazy programmer!

Upvotes: 0

Views: 122

Answers (1)

Richard
Richard

Reputation: 27508

There is no option on the GBARLINE procedure for outputting the plotting parameters it computes. Your default graphical options probably creates a png image for an html page that is used to present the chart for viewing.

Change the graphics devices to svg and ODS will create html source that contains the drawing instructions for creating the image seen. The instructions will be in the <g> tag. So, if you are truly motivated to be lazy and not hand code the midpoints and axis values, you can write code to parse the html and scrape the computed midpoints and axis ticks from within the <g> tag.

ods html5 file="c:\temp\gbarline.html";

goptions reset=all;
goptions device=svg;

… gbarline … 

ods html5 close;

… parse the ODS created c:\temp\gbarline.html … 

Upvotes: 1

Related Questions