Please I'm trying to create a multicolumn table but I'm not getting anywhere. I want two columns, female and male, with informal, formal and total under as the picture shows. This is my code, but the output is not what I want. Thanks.
\documentclass[a4paper,12pt]{book}
\usepackage{amsmath}
\usepackage{bm}
\pagestyle{plain}
\usepackage{setspace}
\raggedbottom
\usepackage{mathtools}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{array, booktabs, ragged2e}
\usepackage{threeparttablex}
{\renewcommand*{\arraystretch}{1.5}
\begin{spacing}{.85}
\begin{ThreePartTable}
\begin{TableNotes}
\footnotesize
\item [a] Data source: SLLFS 2014
\item [b] Percentage values in the table are percentages of the number of women (xxxx) and men (xxxx) in the sample
\end{TableNotes}
\begin{longtable}{p{1ex}>{\RaggedRight}p{1.95cm}*{3}{p{1.45cm}p{2cm}}}
\caption{Characteristics of study sample by job type and gender\tnote{a}}\label{chap1:tab1}\\\toprule
\endfirsthead
\multicolumn{7}{p{4cm}} {Table 1 (\emph{continued})}\\ \toprule
& & \multicolumn{2}{l}{Female} & \multicolumn{2}{l}{Male} & \\
\cmidrule{3-4} \cmidrule(lr){5-6} \cmidrule{7-8}
& & Informal & Formal & Total & Informal & Formal & Total \\\midrule
\endhead
\hline\multicolumn{7}{r}{\tablename\ \thetable\ -- \textit{Continued on next page}} \\
\endfoot
\hline
\insertTableNotes % tell LaTeX where to insert the contents of "TableNotes"
\endlastfoot
& & \multicolumn{2}{l}{Female} & \multicolumn{2}{l}{Male} &\\
\cmidrule{3-4} \cmidrule(lr){5-6} \cmidrule{7-8}
& & Informal & Formal & Total & Informal & Formal & Total \\\midrule
\multicolumn{2}{l}{\textit{Age}} & \\
& 15-24 & 663 & 20.994 & 19 & 5.791 & 682 & 20.019\\
& 25-34 & 1071 & 32.091 & 114 & 37.959 & 1185 & 32.383\\
& 35-44 & 866 & 23.826 & 86 & 28.394 & 952 & 24.053\\
& 45-54 & 530 & 15.416 & 58 & 18.217 & 588 & 15.555\\
& 55-64 & 251 & 7.721 & 29 & 9.636 & 280 & 7.816\\
\bottomrule
\end{longtable}
\end{ThreePartTable}
\end{spacing}
}




\multicolumn{2}rather than\multicolumn{3}for the 'Female' and 'Male' headings. Just change those and then similarly for the rules - you're just one off in each case. – cfr May 24 '18 at 00:27