BookmarkSubscribeRSS Feed
NeilSmith
Fluorite | Level 6

Hi everyone, I am using a proc summary like the one below:

proc summary data = summary;

class group;

var x1-x10;

output out = summary_yes;

run;

 

However, my proc summary has some rows at the top where group = '.' How do I delete these rows? I want to start at group 1, not at group '.'. Thanks in advance!

2 REPLIES 2
novinosrin
Tourmaline | Level 20

Please add NWAY option in proc summary statement

proc summary data = summary nway;
ballardw
Super User

Proc Summary/Means by default will include summaries for all combinations of all the class varaibles, including all records. If you examine your output data set there is a variable named _type_ that has values of 0 and 1. The 0 is the overall summary. If you have two Class variables you will have _type_ = 0,1,2 and 3. 0 would be the overall summary, 1 the summary of only one of the class varaibles, 2 the other class variable and 3 would be the combinations of the class variables.

The NWAY option on the procedure statement says to only include the combinations of all the variables and not the overall, in effect selecting only the largest value of the _type_ variable. There are also statments like WAYS and TYPES that offer other methods of controlling which subsets of the combinations of class variables appear in the output. Completetypes option on the Proc statement will make sure that all combinations of the values of the class variables, even those that do occur in the data, are present in the summary.

 

This can be a very helpful feature as you can get multiple summaries with one pass through the data and select the desired data by filtering on the _type_ variable.

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 336 views
  • 1 like
  • 3 in conversation