Not applicable
Posts: 0

# Summary table of : sum(value)/N How to ?

I have table that I want to create summary value that I can easily do in Excel Pivot table .. but how can I acheive this goal in Enterprise guide ?

Month is_yes
a 1
a 0
a 1
b 1
b 0

how can I create table summary of

Month is_yes_by_month N(count)
a 33.33% 3
b 50% 2
Community Manager
Posts: 3,449

## Re: Summary table of : sum(value)/N How to ?

You can use the Query Builder to create a calculated column (or two) based on is_yes. SUM, AVG, COUNT DISTINCT are all built-in summarizations.

The Query Builder (in 4.2 and later) will automatically group the results by the remaining column (Month), so your result with have the summarized answers, one record per Month value.

Chris
Super Contributor
Posts: 366

## Re: Summary table of : sum(value)/N How to ?

Hello IamJeannie,

If you are not against coding and SQL in EG, you can use the following code:
[Pre]
data a;
input Month \$1 Is_Yes;
datalines;
a 1
a 0
a 1
b 1
b 0
;
run;
/* Result */;
proc SQL;
create table r as
select Month, 1-SUM(Is_Yes)/COUNT(*) as Is_Yes_by_Month format=Percent7.2,
COUNT(*) as N
from a
group by Month
;quit;
[/Pre]
Sincerely,
SPR
Discussion stats
• 2 replies
• 159 views
• 0 likes
• 3 in conversation