Is there any way to print sum using proc freq .
Ex : I have used proc freq to calculate count and percent , in the same need total of count and percent
E1 Value | Count | Percent |
0 | 24241428 | 40.86 |
1 | 395759 | 0.67 |
2 | 70005 | 0.12 |
3 | 37934 | 0.06 |
4 | 29365 | 0.05 |
5 | 21693 | 0.04 |
6 | 34656 | 0.06 |
99999999 | 34502635 | 58.15 |
Total | 59333475 | 100.01 |
PROC PRINT with the SUM statement does this.
Proc tabulate :
proc tabulate data=sashelp.class;
class age;
table age all,n pctn;
run;
I'm not sure if this is possible with proc freq, but you can create an output dataset of the count and percents in proc freq and then print that dataset with an added sum statement.
*step 1;
ODS OUTPUT DATA=library.dataset;
PROC FREQ DATA=have;
TABLES variable / nocum;
RUN;
*step 2;
PROC PRINT Data = library.dataset;
SUM variable name;
RUN;
Hope that helps!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.