\documentclass{article}
\usepackage{threeparttable}
\usepackage{multirow}
\usepackage{booktabs}
\begin{document}
\begin{table}[!ht]
\setlength\tabcolsep{0pt}
\centering
\begin{threeparttable}
\begin{tabular}{@{\extracolsep{2ex}}*{12}{lccccccccccc}}
\toprule
 &  & \multicolumn{10}{c}{\textbf{group1}} \\
\cmidrule{3-12}
 &  & \multicolumn{5}{c}{\begin{tabular}{@{}c@{}}a \\ (n=4)\end{tabular}} & \multicolumn{5}{c}{\begin{tabular}{@{}c@{}}b \\ (n=4)\end{tabular}} \\
 &  & \multicolumn{5}{c}{\textbf{group2}} & \multicolumn{5}{c}{\textbf{group2}} \\
\cmidrule{3-7}\cmidrule{8-12}
 &  & \multicolumn{2}{c}{\begin{tabular}{@{}c@{}}e \\ (n=2)\end{tabular}} & \multicolumn{2}{c}{\begin{tabular}{@{}c@{}}f \\ (n=2)\end{tabular}} & \begin{tabular}{@{}c@{}}Total \\ (n=4)\end{tabular} & \multicolumn{2}{c}{\begin{tabular}{@{}c@{}}e \\ (n=2)\end{tabular}} & \multicolumn{2}{c}{\begin{tabular}{@{}c@{}}f \\ (n=2)\end{tabular}} & \begin{tabular}{@{}c@{}}Total \\ (n=4)\end{tabular} \\
 &  & \multicolumn{2}{c}{\textbf{group3}} & \multicolumn{2}{c}{\textbf{group3}} &  & \multicolumn{2}{c}{\textbf{group3}} & \multicolumn{2}{c}{\textbf{group3}} &  \\
\cmidrule{3-4}\cmidrule{5-6}\cmidrule{8-9}\cmidrule{10-11}
 & \textbf{\begin{tabular}{@{}c@{}}Total \\ (n=8)\end{tabular}} & \begin{tabular}{@{}c@{}}c \\ (n=1)\end{tabular} & \begin{tabular}{@{}c@{}}d \\ (n=1)\end{tabular} & \begin{tabular}{@{}c@{}}c \\ (n=1)\end{tabular} & \begin{tabular}{@{}c@{}}d \\ (n=1)\end{tabular} &  & \begin{tabular}{@{}c@{}}c \\ (n=1)\end{tabular} & \begin{tabular}{@{}c@{}}d \\ (n=1)\end{tabular} & \begin{tabular}{@{}c@{}}c \\ (n=1)\end{tabular} & \begin{tabular}{@{}c@{}}d \\ (n=1)\end{tabular} &  \\
\midrule
\textbf{value1} &  &  &  &  &  &  &  &  &  &  &  \\
\hspace{12.0pt}Mean (SD) & 4.5 (2.45) & 1 (NaN) & 3 (NaN) & 2 (NaN) & 4 (NaN) & 2.5 (1.29) & 5 (NaN) & 7 (NaN) & 6 (NaN) & 8 (NaN) & 6.5 (1.29) \\
\hspace{12.0pt}Median [Min, Max] & 4.5 [1, 8] & 1 [1, 1] & 3 [3, 3] & 2 [2, 2] & 4 [4, 4] & 2.5 [1, 4] & 5 [5, 5] & 7 [7, 7] & 6 [6, 6] & 8 [8, 8] & 6.5 [5, 8] \\
\textbf{value2} &  &  &  &  &  &  &  &  &  &  &  \\
\hspace{12.0pt}a & 3 (37.5\%) & 1 (100\%) & 0 (0\%) & 0 (0\%) & 1 (100\%) & 2 (50\%) & 0 (0\%) & 1 (100\%) & 0 (0\%) & 0 (0\%) & 1 (25\%) \\
\hspace{12.0pt}b & 3 (37.5\%) & 0 (0\%) & 0 (0\%) & 1 (100\%) & 0 (0\%) & 1 (25\%) & 1 (100\%) & 0 (0\%) & 0 (0\%) & 1 (100\%) & 2 (50\%) \\
\hspace{12.0pt}c & 2 (25\%) & 0 (0\%) & 1 (100\%) & 0 (0\%) & 0 (0\%) & 1 (25\%) & 0 (0\%) & 0 (0\%) & 1 (100\%) & 0 (0\%) & 1 (25\%) \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}