I am reviewing an old project by someone who is no longer reachable.

I have her .dta file with input data and the .do file with her analysis. However, the .dta file contains a large number of variables/columns and is simply a mess overall. Many of these variables were poorly named so that it's hard to distinguish what variables are used in the .do file and what variables are never used. For instance, there are several variations of variables containing GDP data (e.g. GDP_11, GDP_12, GDP_101, etc.) when in the end only one of these variations is used in the analysis contained in the .do file. This takes place with other variables as well.

Is there a way for me to find out what variables in the .dta are actually used in the .do file? I would like to remove all variables from that .dta file that are not used the code contained in the .do file.

Thank you in advance.