Mishkat al-Masabih 572
وَعَنْ عَمْرِو بْنِ شُعَيْبٍ عَنْ أَبِيهِ عَنْ جَدِّهِ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «مُرُوا أَوْلَادَكُمْ بِالصَّلَاةِ وَهُمْ أَبْنَاءُ سَبْعِ سِنِينَ وَاضْرِبُوهُمْ عَلَيْهَا وَهُمْ أَبْنَاءُ عَشْرٍ سِنِين وَفَرِّقُوا بَيْنَهُمْ فِي الْمَضَاجِعِ» . رَوَاهُ أَبُو دَاوُدَ وَكَذَا رَوَاهُ فِي شرح السّنة عَنهُ
From ʿAmr ibn Shuʿayb, from his father, from his grandfather, who said: The Messenger of Allah ﷺ said: "Command your children to pray when they are seven years old, and beat them for it when they are ten years old, and separate them in their beds." Reported by Abu Dawud, and likewise he reported it in Sharh as-Sunnah from him.