BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Ronein
Onyx | Level 15

Hello

I want to create a data set called nlev_all that contain formation of  number of missing observations.

The data set was created and it is 100% fine.

The problem is that I don't want to print it.

What is the way to prevent print of data set nlev_all?

 

 

 

ods output nlevels=work.nlev_all;
proc freq data=sashelp.shoes nlevels;
tables _all_ /noprint;
run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You have to tell PROC FREQ to write something in order to ODS OUTPUT to have something to write to the dataset.

So you just need to suppress any other active ODS destinations from displaying the output also. 

Use ODS SELECT statements.

ods select none;
ods output nlevels=nlevels;
proc freq data=sashelp.class nlevels;
tables _all_ / noprint;
run;
ods select all;
proc print data=nlevels;
run;

 

View solution in original post

10 REPLIES 10
andreas_lds
Jade | Level 19

Looking at the docs of proc freq, it seems an option exists preventing all printed output.

Ronein
Onyx | Level 15

I looked and haven't seen the solution, this is the reason that I ask here

PaigeMiller
Diamond | Level 26

If your print is going to HTML, try

 

ods html select none;
--
Paige Miller
Ronein
Onyx | Level 15
The print is going to "Results" window.
May you show the full code?
I am trying to apply your answer but get error
PaigeMiller
Diamond | Level 26

Is it not HTML in the results window? Have you opened some other destination for output?

 


@Ronein wrote:
I am trying to apply your answer but get error

You have been in the forum for many years now. You should know that when you get an error, you should show us _____________

 

Please show that to us. Don't make us ask, just do it every single time.

--
Paige Miller
Ronein
Onyx | Level 15

This is not the answer since NOPRINT option prevent the print of the frequency table but don't prevent the print of NLEVELS table

ballardw
Super User

@Ronein wrote:

Hello

I want to create a data set called nlev_all that contain formation of  number of missing observations.

The data set was created and it is 100% fine.

The problem is that I don't want to print it.

What is the way to prevent print of data set nlev_all?

 

 

 

ods output nlevels=work.nlev_all;
proc freq data=sashelp.shoes nlevels;
tables _all_ /noprint;
run;

 

 


I am afraid that anything that  is suppressed in the ODS results will not populate a data set created with ODS OUTPUT. The ODS output uses only information sent to an ods destination. If you do not want something to appear in a report document then create the data set outside of the ODS sandwich that defines the start/end of the output document and then use the data set created as needed.

 

Dummy code example:

ods output nlevels=work.nlev_all;
proc freq data=sashelp.shoes nlevels;
tables _all_/noprint;
run;


ods rtf file='<path to report file>\reportdocumentname.rtf';

proc print work.nlev_all <print options>
run;

ods rtf close;
Tom
Super User Tom
Super User

You have to tell PROC FREQ to write something in order to ODS OUTPUT to have something to write to the dataset.

So you just need to suppress any other active ODS destinations from displaying the output also. 

Use ODS SELECT statements.

ods select none;
ods output nlevels=nlevels;
proc freq data=sashelp.class nlevels;
tables _all_ / noprint;
run;
ods select all;
proc print data=nlevels;
run;

 

Reeza
Super User

https://blogs.sas.com/content/iml/2015/05/26/suppress-ods.html

 

ods select none;
ods output nlevels=work.nlev_all;
proc freq data=sashelp.shoes nlevels;
tables _all_ /noprint;
run;
ods select all;

@Ronein wrote:

Hello

I want to create a data set called nlev_all that contain formation of  number of missing observations.

The data set was created and it is 100% fine.

The problem is that I don't want to print it.

What is the way to prevent print of data set nlev_all?

 

 

 

ods output nlevels=work.nlev_all;
proc freq data=sashelp.shoes nlevels;
tables _all_ /noprint;
run;

 

 


 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 3831 views
  • 0 likes
  • 6 in conversation