Globals are ways to use shortcuts in STATA. Think of them of ways of carrying a bunch of information but in just one word. Here are some examples:
This works nicely when you are trying to run a bunch of regressions with a bunch of controls, or if you want different controls in different regressions you can think of creating a global called “controls1” and another one called “controls2”
Another great way of using globals, are for filepaths. For example say all your work for one project is on one folder named “hw1” or “projectx” then you want to put a bunch of output in that filepath, and instead of always wondering where that filepath is you can defined it at the beginning of your dofile. For example, I just downloaded some data from github, and I’ll output stuff to the downloads folder, so I can create a global called “downloads” that will point to the download folder.
global downloads "/Users/laptop/Downloads/"
use "$downloads/dataset_2.13.dta", clear