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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1516 views
  • 2 likes
  • 2 in conversation