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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5283 views
  • 2 likes
  • 4 in conversation