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

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;

截屏2023-07-27 下午7.05.34.png

截屏2023-07-27 下午7.11.44.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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;

View solution in original post

3 REPLIES 3
SASKiwi
PROC Star

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;
Sikcion
Fluorite | Level 6

It works! Thank you!!

ballardw
Super User

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.

 

 

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 3 replies
  • 445 views
  • 0 likes
  • 3 in conversation