How to append multiple ODS html exports into single HTML file? - sas

I'm exporting multiple datasets using ODS html (example below).
It saves HTML files on the server and in order to attach them to email.
The code is used to export looks like this:
ods html file="/user_data/maexport/generated_html.html";
proc print data=WORK.DATA_SET_0001;
run;
ods html close;
Now how can I append these multiple proc printed HTMLs into single HTML file?

Put all your prints before your ODS close statement.

Related

How to change "SAS Output" in web-browser tab with ODS HTML command?

I output the results to HTML using a command like this:
proc import out=DATASET
datafile="DATASET.csv"
dbms=csv replace;
run;
ods html body='html_page.htm' style=HTMLBlue;
proc means data=teeth ;
run;
ods html close;
When I view html_page.htm in a web-browser, the tab is labeled "SAS Output". If I look at the source code of html_page.htm I see that this is under the tag <TITLE> SAS Output </TITLE>. So I tried the following command but it didn't work:
ods html title=`NEW TAB TITLE` body='html_page.htm' style=HTMLBlue;
proc means data=teeth ;
run;
ods html close;
How can I change the tab title with and ODS HTML command?
Specify the page title in the sub-options of ODS HTML BODY option.
ods html body='html_page.htm'(title="My Title") style=HTMLBlue;

SAS PROC TEMPLATE TEXT BREAK LINES

My aim is to generate an fdf output due to SAS so I can import it into adobe.
Unfortunately, my proc template produced file "template.fdf" is just single row. However, I need a new line of code after every put statement. Is there a way to insert this?
Thank you in advance
PROC TEMPLATE;
DEFINE TAGSET template.FDF / STORE = SASUSER.TEMPLAT;
DEFINE EVENT DOC_BODY;
START:
put "%FDF-1.2 "; <=== new breakline in the document
PUT "text"; <=== new breakline in the document
put "<</Root 1 0 R>> ";<=== new breakline in the document
FINISH:
PUT "%%EOF";
END;END;
RUN;
FILENAME OUT "C:\..\template.FDF";
ODS LISTING CLOSE;
ODS MARKUP BODY = OUT
TAGSET = template.FDF;
ODS MARKUP CLOSE; ODS LISTING;
NL option on PUT statement
put "%FDF-1.2 " nl;
From example 3
TEMPLATE Procedure: Creating Markup Language Tagsets

HTML output in SAS

I only see results of my SAS programs in Log like:
16488 title '6';
16489
16490 ods html file = 'E:\Dev\ka\body1.html';
16491
16492
16493 proc means data=learn.blood;
16494 var RBC WBC;
16495 output out = means mean = M_RBC M_WBC;
16496 run;
It's not show any error, but I don't see results in html file.
How to turn on html output?
You may have the setting 'Show results as they are generated' off.
Check your preference settings.
Confirm your HTML file is created as well, though you may need to include a CLOSE before it is fully available.
ods html file = 'E:\Dev\ka\body1.html'
proc means data=sashelp.class;
var height weight;
output out=means mean=M_Height M_Weight;
run;
ods html close;
Works fine for me. I adapted your code slightly to test it:
ods html file="%sysfunc(pathname(work))\body1.html";
proc means data=sashelp.class;
var height weight;
output out=means mean=M_Height M_Weight;
run;
%put Your file has been output to: %sysfunc(pathname(work))\body1.html;
I am seeing results. Are you sure you have observations in your dataset and that there are no errors or warnings being printed to the log?

The date and the time that SAS program started are printed at the top of each page in listing output, why are not printed on html output?

options date/nodate;
This option has no effect on my html output but it works fine on listing output. Also explain how to print date time on html output same like listing output?
/*----prints date in the upper right side of the output------*/
options dtreset date;
ods listing;
Title; /*I dont want to print any title*/
proc print data=sashelp.class;
run;
ods listing close;
/*----for html ods, date is not printed----------------------*/
options dtreset date;
ods html;
Title; /*I dont want to print any title*/
proc print data=sashelp.class;
run;
ods html close;
Working as designed; according to the documentation:
Note: In an interactive SAS session, the date and time are noted only in the output window.
Output window means the listing destination, by the way (separate from the Results Window which is where modern ODS destinations, including HTML, go).
If you want it in HTML, you'll need to add it to the title:
title "(other things) &sysdate.";
Or &Sysdate9. if you prefer that format.
Some other ways to do this are discussed in Art Carpenter's Placing Dates in Your Titles.

How to restore the default html output destination in SAS?

This must be so simple, but I can't find it:
How do you restore the default output destination in SAS 9.3?
Unlike 9.2, that is HTML.
In other words, which commands voids this statement.
ods html close;
You can turn HTML back on with
ODS HTML;
but there are probably other options you need...like a filename
ODS html file="My File.htm";
ODS HTML