Date: Feb 2, 2012 3:13 PM
Author: Shatrughan
Subject: help with NaN removal from dataset class using group mean value

Hello,
I have question for removing NaN with nanmean of the "group" value. I am working with dataset class (since it is alrge amount of data).

Example below explains my data, further a solution I wanted for this is given down.
Example:
******************************************************************
grp var
'A' 5
'A' 5
'A' 5
'A' 5
'A' NaN
'A' 5
'A' NaN
'A' 5
'A' 5
'A' 5
'B' 6
'B' 6
'B' NaN
'B' 6
'B' 6
'C' 7
'C' 7
'C' NaN
'C' 7
*******************************************************************
*******************************************************************
Solution (I want) should be:
grp var
'A' 5
'A' 5
'A' 5
'A' 5
'A' NaN (replaced with value = 5)
'A' 5
'A' NaN (replaced with value = 5)
'A' 5
'A' 5
'A' 5
'B' 6
'B' 6
'B' NaN (replaced with value = 6)
'B' 6
'B' 6
'C' 7
'C' 7
'C' NaN (replaced with value = 7)
'C' 7
******************************************************************
******************************************************************

Any help in removing NaNs with this approach (of nanmean value of group) will be appreciated.
Thanks a ton in advance,
Shatrughan