How to left-align ActiveX graphs in SAS® Stored Processes that are rendered in SAS® Enterprise Guide® and the SAS® Add-In for Microsoft Office


When you open a SAS Stored Process in SAS Enterprise Guide or the SAS Add-In for Microsoft Office, the OPTIONS NOCENTER statement might be ignored for ActiveX graphs. Specifically, the graphs might align in the center of the widest portion of the results instead of aligning to the left.

As a workaround, you can explicitly assign the _ODSDEST stored process macro variable to tagsets.MSOFFICE2K in the stored process code. This forces the stored process output to display using the tagsets.MSOFFICE2K ODS destination. The tagsets.MSOFFICE2K ODS destination honors the OPTIONS NOCENTER statement. See the code below for an example of how to use this macro variable. 

*ProcessBody; 

%global _ODSDEST _ODSSTYLE;

proc template;
  define style styles.nobreak;
  parent=styles.analysis;
  style body from body /
  pagebreakhtml=_undef_;
end;
run;

%let _ODSDEST=tagsets.MSOFFICE2K;
%let _ODSSTYLE=styles.nobreak;

%STPBEGIN;  

ods &_ODSDEST style=&_ODSSTYLE;

options nocenter;

TITLE;
    TITLE1 "Test Title";
    TITLE2 "Test Title 2";
    TITLE3 "Test Title 3";

TITLE;

SYMBOL1 
    INTERPOL=JOIN 
    HEIGHT=10pt 
    VALUE=NONE 
    LINE=1 
    WIDTH=2 
 
    CV = _STYLE_ 

Axis1 
    STYLE=1 
    WIDTH=1 
    MINOR=NONE 
 
 

Axis2 
    STYLE=1 
    WIDTH=1 
    MINOR=NONE 
 

TITLE; 
TITLE1 "Line Plot for SASHELP.CLASS"; 
FOOTNOTE; 
FOOTNOTE1 "Generated by the SAS System (&_SASSERVERNAME, &SYSSCPL) on 
%TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))"; 

PROC SQL; 
  CREATE VIEW WORK.SORTTempTableSorted AS 
  SELECT  Sex,Age , 
  SUM(Height) AS Height_SUM  
  FROM SASHELP.CLASS  
  GROUP BY Sex,Age 
  ORDER BY Sex,Age 

 QUIT;
 
PROC GPLOT DATA = WORK.SORTTempTableSorted NOCACHE ; 
  PLOT Height_SUM * Age  / 
     VAXIS=AXIS1 
 
    HAXIS=AXIS2 
 
  FRAME; 
  BY Sex; 
run; 
quit; 
 
title; 
footnote; 


title "SASHELP.US_DATA Data"; 
 
proc print data=sashelp.US_DATA noobs; 
run; 
 
title; 

ODS &_ODSDEST close;  

;*';*";*/;quit; 

%STPEND; 

Note: The results format tagsets.MSOFFICE2K inserts HTML page breaks in generated results. To remove these page breaks, modify the style slightly using the PROC TEMPLATE code in the example.