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

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

7 REPLIES 7
ballardw
Super User

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?

kontev
Calcite | Level 5

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.

ballardw
Super User

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.

kontev
Calcite | Level 5

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

ballardw
Super User

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.

Cynthia_sas
SAS Super FREQ


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

kontev
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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