Ods Html only output specific operations?

Accepted Solution Solved
Reply
Super Contributor
Posts: 418
Accepted Solution

Ods Html only output specific operations?

Hello everyone. I have a looped macro code in which I would like to loop through and create many frequency tables for a given dataset. I'd basically like one freq table for each variable, however i'd like each numeric variable to only have 10 distinct buckets.

The issue is I would like all of these values to stack on the same ods html file, however the html file also prints all of the intermediate datasteps that I frankly do not want printed.  Is there an option to specify that everything following should NOT be printed to the ods library?

Here is a sample of my code.

Ods html file="C:\users\...\sample.html";

title distributions of variables;

%do i=1 %to &macroloopvar;

/* DO NOT WANT THIS TO DISPLAY, I'm taking steps to dynamically determine the number of buckets used in the Proc freq report (if there is another way to do this please let me know!!!*/

proc sql;

select max(&variablename)

,min(&variablename) into :&variablename.max,:&variablename.min

from basedata;

quit;

run;

.

.

.

.

/* DO NOT WANT THIS TO DISPLAY*/

proc format;

value bucketingformats

.='missing'

&buckets.;

run;

 

/*want this to display*/

proc freq data=basedata;

tables &variablename. / missing;

format &variablename. Bucketingformats.;

run;

%end;

I realize this is bastardized code but hopefully you can understand what I am trying to do! If you don't understand what i'm going for please let me know!


Accepted Solutions
Solution
‎11-05-2013 08:03 PM
Super User
Posts: 17,819

Re: Ods Html only output specific operations?

The format shouldn't add any output to your HTML.

For the PROC SQL you can add NOPRINT

ie proc sql noprint;

For other procs you can use ods select none; before the procs to make sure that no output goes to the window.

View solution in original post


All Replies
Super User
Posts: 10,497

Re: Ods Html only output specific operations?

You would be better off for your purposes to go through the data one time to make a bucket format for each variable instead of recalculating the bucket format for each variable. Look at making a dataset and use the CNTLIN option on proc format it will probably save you lots of headaches for coding instead of the &buckets which has got to have lots of nasty quoting problems involved.

Proc summary data=basedata;

     var _numeric_;

     output out=minmax min= max=/autoname;

run;

Will get a dataset to start with the min and max for each variable in the data.

proc sql noprint;

     select name into :varlist separated by ' '

     from dictionary.columns where libname='WORK' and memname='BASEDATA';

quit;
Will make a space delimited list of variables to work with. Afte the sql add:

%let NumVars = &sqlobs; to have a variable with the number of variables to loop over.

If you make a format with the variable name from the first data then the proc freq call, done within a macro would be:

proc freq data=basedata;

     tables &varlist;

     format

     %do i = 1 %to &NumVars;

          %let t=%scan(&varlist,&i);

          &t  &t..

     %end;

     ;

run;

Solution
‎11-05-2013 08:03 PM
Super User
Posts: 17,819

Re: Ods Html only output specific operations?

The format shouldn't add any output to your HTML.

For the PROC SQL you can add NOPRINT

ie proc sql noprint;

For other procs you can use ods select none; before the procs to make sure that no output goes to the window.

Super Contributor
Posts: 418

Re: Ods Html only output specific operations?

Ballardw, thank you very much for your input. I am going to do some testing along with what you have said as well.

☑ This topic is SOLVED.

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

Discussion stats
  • 3 replies
  • 170 views
  • 3 likes
  • 3 in conversation