Sunan an-Nasa'i #2000
The Book of Funerals 21:184
It was narrated from 'Ali bin Abi Talib that:
mention was made of standing at the funeral until the body is placed in the grave. 'Ali bin Abi Talib said: "The Messenger of Allah stood, then he sat down."