🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

convert from absolute value to percentage

User: "kayman"
New Altair Community Member
Updated by Jocelyn

Assume I have a recordset as this :

 

a1  a2  a3

1     1    2 

2     2    1 

1     2    1 

 

and I want to convert it from absolute value to percentage so my outcome becomes like this :

 

a1       a2        a3 

25%    25%    40%

50%    25%    40%

25%    50%    20%

 

Or in other words, for each of my attributes I want to get the sum by attribute, and then for each of the value the percentage.

 

I thought I would be able to do this with the loop attributes operator but I am not able to select the content so I'm doing something wrong somewhere.

 

What would be the easiest way to approach this? 

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "Telcontar120"
    New Altair Community Member

    The percentages in your example don't seem to line up properly, but based on your description, I think the fractional count function in the Aggregate operator does what you want. You just have to specify to group by your primary id variable, so it won't really be aggregating if you have no duplicates in your dataset.  But that's fine.  Note that if you want row percentages rather than column percentages you can do something similar with Generate Aggregation.

    User: "Andrew"
    New Altair Community Member
    Accepted Answer

    The Normalize operator has the useful option "proportion transformation" that rescales numeric attributes to be their fractional contribution out of 1. Use Generate Attributes to multiply this by 100 to get a percentage.

     

    Andrew