BookmarkSubscribeRSS Feed
samuelhim
Fluorite | Level 6

Hi,

What is the primary purpose of the class statement in proc summary, and how does it differ from the var statement?

1 REPLY 1
PaigeMiller
Diamond | Level 26

CLASS tells PROC SUMMARY how to divide (some people would say "slice") the data. VAR tells PROC SUMMARY which variables to compute statistics on.

 

So, look at the output of this:

 

proc summary data=sashelp.class;
    class sex age;
    var weight height;
    output out=means mean=/autoname;
run;

 

This finds the mean of weight and height for all values of Sex, it finds the mean of weight and height for all values of Age and it finds the mean of weight and height for all combinations of all values of Sex and Age. It also produces the overall mean for these two variables.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1234 views
  • 2 likes
  • 2 in conversation