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

## A question about proc means output

Hi guys! I met a question is that

I want to use the proc means function to calculate the mean/std/N value of each category in the treatment group and visit weeks. In the result part , the table seems exactly what I want(picture1), while in the output dataset, it looks so strange that it contains some calculations of total column of weeks and treatment group(picture2 first 8 rows).

How I can get the output table without those total calculation rows? Thank you!

proc means data=ADLB01 mean std n missing;
var AVAL;
class AVISITN_1 Trt01an;
output out=visit1 mean=Mean std=SE n=N;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Opal | Level 21

## Re: A question about proc means output

If you add the NWAY option, it doesn't do higher summaries:

``````proc means data=ADLB01 mean std n missing nway;
var AVAL;
class AVISITN_1 Trt01an;
output out=visit1 mean=Mean std=SE n=N;
run;``````
3 REPLIES 3
Opal | Level 21

## Re: A question about proc means output

If you add the NWAY option, it doesn't do higher summaries:

``````proc means data=ADLB01 mean std n missing nway;
var AVAL;
class AVISITN_1 Trt01an;
output out=visit1 mean=Mean std=SE n=N;
run;``````
Calcite | Level 5

## Re: A question about proc means output

It works! Thank you!!

Super User

## Re: A question about proc means output

This behavior of Proc Means/Summary is quite useful once you understand what goes on. The NWAY option means to only provide the highest level of the combination of variables as shown in the _type_ variable. Other options for the procedure such as the TYPES and WAYS statements are ways to request specific combinations of the class variables for the output or simple WHERE statements or dataset options.

The feature is useful as you can create summaries in one pass through the data and select the ones you want for a specific output table or analysis later.

One project I worked with provided summaries based on:

State, Region ( a combinations of Counties), County, School Type (public/private/charter, School District, School building and School Grade. One pass through summary let me create the basic summaries needed.

Then for bits of the reports that different people were interested in this created summaries of:

Statewide, Statewide by School Type, Statewide by School Grade, Statewide school type and grade,

Region, Region by School Type, Region by School Grade, Region by School type and Grade

County, (follow the pattern).

I could use the _type_ variable to select the level of report and either BY group or Proc Tabulate/Report options to create pages per subgroup as interested.

Discussion stats
• 3 replies
• 214 views
• 0 likes
• 3 in conversation