The SAS Output Delivery System and reporting techniques

ODS html 2 procedures in 1 file

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

ODS html 2 procedures in 1 file

Hi Guys,

I've lost so much time trying to figure out why something that used to work in the past now it does not. Generally the issue is with the standard ODS html output. I have macros that automatically generates reports. However for some of them the goal is to have 2 procedures outputted into a single html file:

This is the code that used to work fine in the past:

ODS HTML file = "path\Report1.html";

     proc freq data = data;

          table var1;

     run;

     proc freq data = data2;

          table var5;

     run;

ODS HTML CLOSE;

Now it simply creates 2 html files with the output for each of the procedures named Report1.html and Report2.html. I tried to play with the system options but couldn't really figure it out why it does that.

I did managed to get them outputted into 1 html with the following code:

filename example "path\Report1.html" mod;

ODS HTML body=example(nobot) anchor = "first";

     proc freq data = data;

          table var1;

     run;

ODS HTML CLOSE;

ODS HTML body=example(notop) anchor = "second";

    proc freq data = data2;

          table var5;

     run;

ODS HTML CLOSE;

filename example clear;

Nevertheless, the output still does not match the old one in terms positioning among rows and there is also no a separating line between the 2 outputs and since I'm using another VBA macros on those reports it makes everything a mess.

If someone could help me out with that, I would be eternally grateful.

Thank you in advance.

Regards,

Georgi


Accepted Solutions
Solution
‎05-16-2014 11:11 AM
Super User
Posts: 11,343

Re: ODS html 2 procedures in 1 file

Did you try:

ods html path="path" body="File1.html";

Stongly recomend path be a fully qualified path and not relative.

Also, make sure you do not have the ods option NEWFILE set to proc.

View solution in original post


All Replies
Super User
Posts: 11,343

Re: ODS html 2 procedures in 1 file

What has changed since "in the past"? Are you on the same OS, using EG vs base SAS, server versus stand alone?

Are there any log messages associated with the output that look different?

New Contributor
Posts: 4

Re: ODS html 2 procedures in 1 file

It's standard stand alone SAS base from which I'm running the macros. It's possible that the scripts were written in an older version of SAS. But I still don't see why SAS would automatically create another file instead of output the result into the first file or at least there should be some option with which you could explicitly specify not to do that... I don't know as I stated I already invested hours of time trying to get pass that and I still don't have a satisfying result Smiley Sad

For refference: I'm actually comparing the current outputs with the old ones, which are simple frequencies with equal unique values past and present.

Solution
‎05-16-2014 11:11 AM
Super User
Posts: 11,343

Re: ODS html 2 procedures in 1 file

Did you try:

ods html path="path" body="File1.html";

Stongly recomend path be a fully qualified path and not relative.

Also, make sure you do not have the ods option NEWFILE set to proc.

New Contributor
Posts: 4

Re: ODS html 2 procedures in 1 file

The option NEWFILE did the job. However, it is supposed to be set to NONE by default but in my system it seems it is not. Do you have any idea how I could set it to be the default option? Also I just need it to skip the first row before printing the title and the results will be aligned. I tried "options skip=1;" that I found but the output is still printed in the first row instead on the second, any ideas why? Smiley Happy

Super User
Posts: 11,343

Re: ODS html 2 procedures in 1 file

I'm not sure that the system skip option applies to ODS output; it looks more like classic listing control.

You might try ODS text to insert a line before procedure output. If you are using actual title statements you could also try making the first one used Title2.

What to the VBA programs do? You might be able to pre-process in SAS or export data in a different form than proc freq output.

SAS Super FREQ
Posts: 8,862

Re: ODS html 2 procedures in 1 file


Hi: You could always make title1 blank and then start with title2, which should put some extra white space at the top of the output. The documentation for SKIP system option clearly says that it is LISTING control only -- so it will not apply to ODS destination output.

cynthia

New Contributor
Posts: 4

Re: ODS html 2 procedures in 1 file

Thank you very much guys. I tried your suggestions but they didn't provide the desired results e.g. the ODS text line adds too much lines (instead of just 1). Anyway, I decided to fix the lines issue with VBA as it was much easier due to the pattern behind it Smiley Happy

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 535 views
  • 0 likes
  • 3 in conversation