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!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.