Dear Nampuna,

So two quick responses:

1) You can defined numbering within subsections as well. You need to change this line from:




2) What you want to do is not optimal to achieve on Overleaf. With so many tables it will definitely give errors compiling.

Here I would suggest you have LaTeX locally installed using MikTeX ( and a compiler like TeX Studio:

Basically you need to write the file contents file in Stata. You can invoke loops within Stata and push the tables to the .tex file and compile the pdf.

Here are some examples of calling TeX from Stata:

I will also write a guide on local Stata-to-TeX compiling.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store