I'm looking for a good way to do proper project management in Stata. Some info:

1) I have lots of data files and lots of do files, organized in directories.
2) I have a few master do files that call the other do files in subdirs, which call other do files in subdirs.
3) Every do file mostly works on data in the same (sub)dir, hence the working dir should be set to a subdir when executing a do file in a subdir.
4) Do files should also be able to run independently from the master file.

I "solved" this now by passing the subdir as argument to do files in subdirs. At the start of each do file in a subdir I check if the argument is empty. If not, the argument is used to change the working dir (called from the master). If it's empty (ran independently), the working dir is not changed.

This is of couse very cumbersome and not safe when renaming subdirs.

Stata does offer a project file format, but that is just a list of links to files, it doesn't do project management. For instance, the working dir for a project is set to the dir of the project file and all paths used should be relative to that, meaning that files can't be ram independently anymore and the code will contain many more hard coded paths, because also files in subdirs have to assume the working dir is still the project dir. So, changing a dir name using projects becomes even more unworkable (you need to check all your do files for possible references to the renamed dir).

Is there any way to do a more proper project management in Stata?

I haven't found one, so the next question: is there any decent way, without hardcoded paths as arguments, to change the working dir to the path of the do file that is running?

I have had a look at the "project" package but that does not offer me what I need.

Thanks for any advice.