BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12

I used an include to add:

%include "/sashome/programs/storedprocess/devl/Research_Dashboard_Util.sas";

I cut code from a file and added it to a second file to include the code back into the file that will uses the included code.  The code with or without the include should is identical.  However it looks like my ods html changes around the footnote section displaying the background as gray rather than white.


I even commented out all of the file I am including and the gray line still exists so long as I have:

%include "/sashome/programs/storedprocess/devl/Research_Dashboard_Util.sas";


I am using SAS 9.2 and displaying my stored process in a web URL portlet.

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Easiest if you have an Autoexec.sas add

options insert = (SASAUTOS= ("path to put your files");

And then in that folder place files with the macro code. One file per macro. Each file must be named the same as the macro, no other executable code in the file and best if the first line in the file starts with %macro.

You can have multiple entries for the paths for different autocall libraries for different projects if that makes sense to you.

View solution in original post

10 REPLIES 10
ballardw
Super User

Are then any STYLE statements involved in the code?

Does the FOOTNOTE code include any graphic elements? (ie something other than just text)

Does the included program have any %include statements? Or modify any variables that may be used for display options?

You might want to post the code for that included program since that seems to be the likely culprit.

DavidPhillips2
Rhodochrosite | Level 12

I changed the included file to a blank .SAS file for testing.


Yes there are small images.


This is at the top of the file:

%GLOBAL _ODSDEST _ODSSTYLE;

This is before the macro call:

%LET _ODSDEST=HTML;

%LET _ODSOPTIONS=gtitle gfootnote style=normal;


This is the section that acts up:


%MACRO DisplayToolbar();

%LET COMMAND = %nrstr("/SASPortal/Director?_directive=STPRun&_action=execute&_program=");

%LET SP = %SYSFUNC(URLENCODE(&_PROGRAM));

%IF &VIEW=DEFAULT %THEN

  %LET SELF_URL=&SERVER.&COMMAND.&SP;

%ELSE

  %LET SELF_URL=&ADMIN_LINK;

%LET SP_NAME=%SYSFUNC(SCAN(&_PROGRAM,-1,'/'));

%LET PORTLET_TITLE = %SYSFUNC(URLENCODE(&SP_NAME));

%LET MAX = %nrstr("&FORMAT=")MAXIMIZE;

%LET EXCEL = %nrstr("&FORMAT=")EXCEL;

%LET PDF = %nrstr("&FORMAT=")PDF;

%LET SELF_URL_MAX = &SELF_URL.&MAX;

%LET SELF_URL_EXCEL = &SELF_URL.&EXCEL;

%LET SELF_URL_PDF = &SELF_URL.&PDF;

%LET HELP_SP = %2FReports%2FResearch+Dashboard%2FResearch+Dashboard+Help;

%LET HELP_PARAM = %nrstr("&Portlet_Title=");

%LET HELP_URL = &SERVER.&COMMAND.&HELP_SP.&HELP_PARAM.&PORTLET_TITLE;

%LET link1=<a href="&SELF_URL_MAX" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340286016503/home/maximize-icon.gif' alt='Maximize' title='Maximize' height='15' width='15' style='border:none;' /></a>;

%LET link2=<a href="&SELF_URL_EXCEL" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340285950455/home/export-icon.gif' alt='Export to Excel' title='Export to Excel' height='15' width='15' style='border:none;' /></a>;

%LET link3=<a href="&SELF_URL_PDF" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1344203338849/home/pdf-icon.gif' alt='Export to PDF' title='Export to PDF' height='15' width='15' style='border:none;' /></a>;

%LET link4=<a href='javascript:window.print()'><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340286055280/home/print-icon.gif' alt='Print' title='Print' height='15' width='15' style='border:none;' /></a>;

%LET link5=<a href="&HELP_URL" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340285967063/home/help-icon.gif' alt='Help' title='Help' height='15' width='15' style='border:none;'/></a>;

FOOTNOTE1 J=L "&link1 &link2 &link3 &link4 &link5";

%MEND DisplayToolbar;

DavidPhillips2
Rhodochrosite | Level 12

This is a full stored process with the bug

%GLOBAL _ODSOPTIONS _ODSDEST _ODSSTYLE VIEW SERVER;

%LET SERVER = https://&_SRVNAME;

%LET _DEBUG=TIME,FIELDS;

RUN;

%include "/sashome/programs/storedprocess/devl/Research_Dashboard_Util.sas";

%MACRO DisplayToolbar();

%LET COMMAND = %nrstr("/SASPortal/Director?_directive=STPRun&_action=execute&_program=");

%LET SP = %SYSFUNC(URLENCODE(&_PROGRAM));

%LET SELF_URL=&SERVER.&COMMAND.&SP;

%LET SP_NAME=%SYSFUNC(SCAN(&_PROGRAM,-1,'/'));

%LET PORTLET_TITLE = %SYSFUNC(URLENCODE(&SP_NAME));

%LET MAX = %nrstr("&FORMAT=")MAXIMIZE;

%LET EXCEL = %nrstr("&FORMAT=")EXCEL;

%LET PDF = %nrstr("&FORMAT=")PDF;

%LET SELF_URL_MAX = &SELF_URL.&MAX;

%LET SELF_URL_EXCEL = &SELF_URL.&EXCEL;

%LET SELF_URL_PDF = &SELF_URL.&PDF;

%LET HELP_SP = %2FReports%2FResearch+Dashboard%2FResearch+Dashboard+Help;

%LET HELP_PARAM = %nrstr("&Portlet_Title=");

%LET HELP_URL = &SERVER.&COMMAND.&HELP_SP.&HELP_PARAM.&PORTLET_TITLE;

%LET link1=<a href="&SELF_URL_MAX" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340286016503/home/maximize-icon.gif' alt='Maximize' title='Maximize' height='15' width='15' style='border:none;' /></a>;

%LET link2=<a href="&SELF_URL_EXCEL" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340285950455/home/export-icon.gif' alt='Export to Excel' title='Export to Excel' height='15' width='15' style='border:none;' /></a>;

%LET link3=<a href="&SELF_URL_PDF" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1344203338849/home/pdf-icon.gif' alt='Export to PDF' title='Export to PDF' height='15' width='15' style='border:none;' /></a>;

%LET link4=<a href='javascript:window.print()'><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340286055280/home/print-icon.gif' alt='Print' title='Print' height='15' width='15' style='border:none;' /></a>;

%LET link5=<a href="&HELP_URL" target=_blank><img src='https://sites.google.com/site/dashboardsamples/_/rsrc/1340285967063/home/help-icon.gif' alt='Help' title='Help' height='15' width='15' style='border:none;'/></a>;

FOOTNOTE1 J=L "&link1 &link2 &link3 &link4 &link5";

%MEND DisplayToolbar;

%MACRO PrintReport();

%STPBEGIN;

  title "Basic PROC REPORT Report";

  proc report data=sashelp.class;

  run;

%STPEND;

%MEND PrintReport;

%MACRO ProcessReport();

  %LET _ODSDEST=HTML;

  %LET _ODSOPTIONS=gtitle gfootnote style=normal;

  %DisplayToolbar();

  %PrintReport();

%MEND ProcessReport;

%ProcessReport();

The error only occurs when you view the stored process via a web URL Portlet.

DavidPhillips2
Rhodochrosite | Level 12

I think the Include is including other things as well.  Is there a way to only include the macros?

ballardw
Super User

You could move the macros to an autocall library. Then they would be compiled when needed.

DavidPhillips2
Rhodochrosite | Level 12

Researching how to make an autocall library.

ballardw
Super User

Easiest if you have an Autoexec.sas add

options insert = (SASAUTOS= ("path to put your files");

And then in that folder place files with the macro code. One file per macro. Each file must be named the same as the macro, no other executable code in the file and best if the first line in the file starts with %macro.

You can have multiple entries for the paths for different autocall libraries for different projects if that makes sense to you.

DavidPhillips2
Rhodochrosite | Level 12

How do I tell if I have an AUTOEXEC?

I tried the second option in: http://support.sas.com/kb/24/451.html

I created a folder in:

/sashome/programs/storedprocess/devl/Research_Dashboard_Util

I uploaded a file with one macro and named the file the same name as the macro with .SAS extension.


I tried calling the autocall library.

FILENAME fileref '/sashome/programs/storedprocess/devl/Research_Dashboard_Util/';

OPTIONS MAUTOSOURCE SASAUTOS=(SASAUTOS fileref);


It looks like my macro was not pulled in.

jwillis
Quartz | Level 8

When working with Macros in a Stored Process, it is best(?) to assign them as global.  If "_ODSOPTIONS" is not defined as global, SAS could be assigning "_ODSOPTIONS" as a local variable.  In the EG documentation I read about Stored Processes, it said, for best results, to assign macro variables as global before the %stpbegin statement.

%MACRO ProcessReport();

  %LET _ODSDEST=HTML;

  %LET _ODSOPTIONS=gtitle gfootnote style=normal;

  %DisplayToolbar();

  %PrintReport();

%MEND ProcessReport;

%ProcessReport();

DavidPhillips2
Rhodochrosite | Level 12

_ODSOPTIONS is global.  See line:


%GLOBAL _ODSOPTIONS _ODSDEST _ODSSTYLE VIEW SERVER;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 2766 views
  • 3 likes
  • 3 in conversation