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

Dear SAS experts,

 

I am using the following code:

 

proc means data=have MEAN T;
ods output summary=summary1;



Later on I use the result: summary1 as an input in another function.

But at the same time I don't want the result table of the proc means operation itself be presented in my output file.

 

If I use noprint along with the proc means, then SAS doesn't see my summary1 anymore and I can not work with it later on.

What would be you kind advice?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

I would make sure to place the global statements outside of the proc statements.

Works for me.

ods select none;
ods output summary=summary2;
proc means data=sashelp.class MEAN T ;
 var height weight;
run;
ods select all;
proc print data=summary2;
run;

 

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Use PROC SUMMARY instead of PROC MEANS

--
Paige Miller
Reeza
Super User
ods select none;

<proc means code>;


ods select all;

ODS SELECT/EXCLUDE can be used to suppress the output.

 

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

Astana
Calcite | Level 5

If I use this option SAS still tells me that summary2 doesn't exist with an Error message. And Procedure Means is still printed.

ods select none;
        proc means data=have MEAN T ;
        ods output summary=summary2;

ods select all;
    

NOTE: There were 234 observations read from the data set 
NOTE: The PROCEDURE MEANS printed page 1.
NOTE: PROCEDURE MEANS used (Total process time):
      real time           0.02 seconds
      cpu time            0.02 seconds
      

       data want;
        set summary2;
ERROR: File WORK.SUMMARY2.DATA does not exist.
Tom
Super User Tom
Super User

I would make sure to place the global statements outside of the proc statements.

Works for me.

ods select none;
ods output summary=summary2;
proc means data=sashelp.class MEAN T ;
 var height weight;
run;
ods select all;
proc print data=summary2;
run;

 

ballardw
Super User

ODS OUTPUT reformats tables sent to the ODS processor into data sets (crude summary). If you do not create any output to and ODS destination then ODS Output has nothing to work with.

 

With Proc Means you could use the basic output statement which would require listing the statistics requested on the OUTPUT statement and something to rename the output variables such as the Autoname option. But the variables will likely have different names than were created by the ODS OUTPUT and

 

proc means data=have MEAN T noprint;
   output out=summary1 mean= t= /autoname;
run;

though I prefer to use Proc Summary as the output data sets have different structures with defaults.

Reeza
Super User

@ballardw the STACKODS option in PROC MEANS gets you pretty close to the ODS OUTPUT option with OUT statement. 

 


@ballardw wrote:

ODS OUTPUT reformats tables sent to the ODS processor into data sets (crude summary). If you do not create any output to and ODS destination then ODS Output has nothing to work with.

 

With Proc Means you could use the basic output statement which would require listing the statistics requested on the OUTPUT statement and something to rename the output variables such as the Autoname option. But the variables will likely have different names than were created by the ODS OUTPUT and

 

proc means data=have MEAN T noprint;
   output out=summary1 mean= t= /autoname;
run;

though I prefer to use Proc Summary as the output data sets have different structures with defaults.


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 4108 views
  • 1 like
  • 5 in conversation