You can add one or more 'by' variables to almost every SAS proc.
If you're doing unique counts you probably want to look at proc freq or proc sql with count distinct instead of proc means.
Generally its a two step proc freq procedure or a single proc sql procedure. Depending on the data of course.
Thank you. But what I also mean is that before I have 1 summary table for the whole data set (30 years of data). Is that also possible to have several tables of summary each for 5 years interval (thus 6 tables)?
Then Art is correct, add a by statement.
You will probably also need a format to define your groups. If you use a by statement you will get the desired groupings. If you use a class statement instead (i.e., replace the word by with the word class), you will get an extra line that shows the grand totals:
data have;
do year=1983 to 2012;
do i=1 to 19;
set sashelp.class point=i;
output;
end;
end;
stop;
run;
proc format;
value years
1983-1987='1983-1987'
1987-1992='1987-1992'
1993-1997='1993-1997'
1998-2002='1998-2002'
2003-2007='2003-2007'
2008-2012='2008-2012'
;
run;
proc means data=have min max mean median stackods;
var height weight;
weight age;
by year;
format year years.;
output out=sample_summary median= mean= min= max= stddev= /autoname;
run;
Thank you very much!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.