How can I find the average of total_fat and mono_fat if I have data in long format and some ID appears 1 time and some appears two times. I want to have only 1 ID if the ID appears twice, I want to average it and make it appears only 1 time.
input str8 pid double(TOTAL_FAT MONO_FAT)
"01010001" 38.980000000000004 12.6
"01010001" 36.08 13.27
"01010006" 70.07000000000001 25.23
"01010006" 28.830000000000002 11.52
"01010007" 38.34 13.76
I want
01010001 37.5 12.9
01010006 39. 18
0101007 38.3. 13.76
input str8 pid double(TOTAL_FAT MONO_FAT)
"01010001" 38.980000000000004 12.6
"01010001" 36.08 13.27
"01010006" 70.07000000000001 25.23
"01010006" 28.830000000000002 11.52
"01010007" 38.34 13.76
I want
01010001 37.5 12.9
01010006 39. 18
0101007 38.3. 13.76
Comment