Changing summary statistics output into input

Reply
New Contributor
Posts: 2

Changing summary statistics output into input

I input my raw data and now I want to use my summary statistics as my new input, so I can further analyze it. How do I do this?
N/A
Posts: 0

Re: Changing summary statistics output into input

You have to create output-datasets from your summary statistics. How to actually do it depends on which proc you use, but in general there are two methods used by SAS:

1) the output statement
proc means data = DSN noprint;
var Var1;
output out = DSN_out statistic-keyword= ;
run;

2) the out-option
proc freq data = DSN noprint;
tables Var1 / out = DSN_out;
run;

See SAS documentation for the proc you are going to use / using.
SAS Super FREQ
Posts: 8,718

Re: Changing summary statistics output into input

Hi!
There is a third method:
[pre]
ods output summary=work.msum;
proc means data=sashelp.shoes min mean max;
var sales;
class region;
run;
[/pre]
ODS OUTPUT allows you to capture any ODS output object into a SAS dataset. Most SAS procedures have output objects and you are able to detect the name of the output objects produced by a procedure by using the ODS TRACE statement:
[pre]
ODS TRACE ON /label;
proc means data=sashelp.shoes min mean max;
var sales;
class region;
run;
ODS TRACE OFF;
[/pre]
If you examine the ODS TRACE output in the SAS log, you will see that the name of the output object produced by PROC MEANS is "Summary". The ODS OUTPUT destination is very useful if your item of interest is not output by the output methods shown above OR if your procedure of interest does not support an output or out= method.

Some SAS procedures produce only 1 output object, other SAS procedures produce different output objects based on procedure options and/or BY or CLASS processing or because the procedure itself (like PROC UNIVARIATE) produces multiple output objects in a single run.

Good luck!
cynthia
N/A
Posts: 0

Re: Changing summary statistics output into input

In your book of the 50 most important things to remember about SAS that you might not often use, this ranks in the first few pages.

Cynthia showed me this in a class a few years ago, and it has been a constant companion, getting me out of trouble with a number of required result sets.

Unlike Cynthia, this doesn't sit at the front of my memory like basic Proc and Data steps, so I highlighted it in my little black book and am grateful every time I have to refresh my memory.

Kind regards

David
Ask a Question
Discussion stats
  • 3 replies
  • 374 views
  • 0 likes
  • 3 in conversation