BookmarkSubscribeRSS Feed
ss171
Calcite | Level 5

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 ValueCountPercent
02424142840.86
13957590.67
2700050.12
3379340.06
4293650.05
5216930.04
6346560.06
999999993450263558.15
Total59333475100.01
3 REPLIES 3
PaigeMiller
Diamond | Level 26

PROC PRINT with the SUM statement does this.

--
Paige Miller
Ksharp
Super User

Proc tabulate :

 

 

proc tabulate data=sashelp.class;
class age;
table age all,n pctn;
run;
strong_s
Fluorite | Level 6

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-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 6164 views
  • 2 likes
  • 4 in conversation