Two commands sharing the same sub-functions
It is common that two ado-files in the same package share a lot of sub-commands (also called utility commands, functions etc.). It is bad practice to write the commands in one file first and copy and paste the sub-commands to the other ado-file. This is ad practice as updating these commands is very likely to lead to errors. This is a part of the DRY coding principle that is one of the few coding paradigms that all computer scientists agree on.
This Gist explains how you can set this up in a Stata environment.
The mySubCommandsXYZ.do file
You should give this file a unique name if you are planning on publishing commands using this method as there will be a name conflict if someone else also have a file called mySubCommandsXYZ.do or whatever you end up calling your file.
This file includes all sub-commands that should be included in the ado-files for the commands. The commands in this file may not have