From: BruceBrad on
Is there a startup option to force a SAS program running in batch mode
to create a html file containing all the listing output? I need a
solution that doesn't require any code in the program itself (though
code in the autoexec.sas file would be OK).
From: Tom Abernathy on
On May 27, 1:52 am, BruceBrad <b.bradb...(a)unsw.edu.au> wrote:
> Is there a startup option to force a SAS program running in batch mode
> to create a html file containing all the listing output? I need a
> solution that doesn't require any code in the program itself (though
> code in the autoexec.sas file would be OK).

You might try adding a line like this to the autoexec to automatically
send the html output to a file with the same base name as the but with
the .log extension changed to .html.

ods html
file="%sysfunc(tranword(%sysfunc(getoption(log)),.log,.html))" ;

From: John Hendrickx on
On 27 mei, 07:52, BruceBrad <b.bradb...(a)unsw.edu.au> wrote:
> Is there a startup option to force a SAS program running in batch mode
> to create a html file containing all the listing output? I need a
> solution that doesn't require any code in the program itself (though
> code in the autoexec.sas file would be OK).

Try this:
%macro htmlOutput;
%local prgname;
%let prgname= %sysfunc(GetOption(SYSIN));
%if %length(&prgname) eq 0 %then %return;

%let outname=%sysfunc(tranword(&prgname,.sas,.html));
ods _all_ close;
ods html file="&outname";
%mend;

If you're not running in batch, &prgname will be empty and the macro
will terminate without doing anything. If you are running it batch, it
will redirect all output to an HTML file. It could be it won't work
because there's no "ods html close" statement but I assume that won't
be necessary.

Note that if your program contains other output redirection
statements, ods or proc printto, they'll have precedence.

Good luck