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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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