My data set looks like this 10001_t 10001_C1 10001_C2 10001_C3 10001_C4 10002_t 10002_B1 10001_B2 10001_B3 value1 value2 value3 value4 value5 value6 value7 value8 value9 value10 value11 value12 value12 value14 value15 valu16 value17 value18 value19 value20 value21 value22 value23 value24 valu25 value26 value27 value28 value29 value30 value31 value32 value33 valu34 value35 value36 Now, I want to divide all the values in 10001_C1 with values in 10001_t , similarly all values in column 10001_C2 will be divided by 10001_t ( which is like the total for that 'C' group, here 10001_C1 is considered as C group) . Division will take place till 10001_C4 column after that the denominator will change ( i.e earlier it was value2/value1 , value3/value1, value4/value1, value5,value1). Now everytime the column name had 't' at the end the denominator will change so when 10002_t comes the denominator will be value_6, so the new table will have percent value in 10002_B1 column as value7/value6, the column 10001_B2 will have vlaue8/value6 and 10001_B3 will have value9/value6. I know its a bit confusing but it's all I have and would really appreciate if someone can suggest a way to solve it. I don't mind if we divide in same table or create a new one. Also the data set is quite big so the code has be dynamic. will really appreciate any help I can get. Thanks
... View more