HI y'all,
I know that there is a way to get either or both of PROC MEANS or PROC SUMMARY to give me a simple count of a character variable by a couple of CLASS variables. I am pretty sure that before PROC MEANS and PROC SUMMARY basically became one and the same, that SUMMARY supported that, while MEANS did not. but so far, my attempts to get this elusive number have been unsuccessful.
Does anyone know how to do this? I really do not want to resort to DATA step or PROC SQL.
thanks,
Donna
PROC FREQ is the tool you want. It should be your first choice whenever you have to count things.
Syntax should be the same.
proc summary data=sashelp.class;
class sex ;
output out=want ;
run;
proc print;
run;
Try to get frequency through proc means:-
proc means data=sashelp.class n;
class name sex;
output out=means_out (DROP=_type_ _freq_ );
data means_out;
set means_out;
where _STAT_='N';
run;
proc print;
run;
Use the TABLE statement in PROC FREQ. You can add the OUT= option if you need the counts in a data set.
proc freq data=sashelp.class;
table sex / out=FreqOut;
run;
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.
Ready to level-up your skills? Choose your own adventure.