Skip to content

Instantly share code, notes, and snippets.

Last active March 17, 2018 17:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Bringing up the variable manager window while using Stata command line

If you are like me, when you are using Stata's command window you do not like to switch to using the mouse to bring up the variable manager window whenever, e.g., you want to check the name of a variable.

One solution is assigning the following commands to a certain function key (e.g., F2) and running it every time you load Stata by adding it to your file.

global F2 : display "varm" _char(13) "sleep 1000" _char(13) "window manage forward command;"

Everytime you press F2, the variable manager window will be displayed for 1 second.

How it works

display is special macro function that converts its argument to a Stata string. I am passing it three separate commands, so each commands is followed by "_char(13)" directive which inserts a carriage return in the returned string (akin to pressing the enter key after typing each command). The first command "varm" brings up the variable manager window. The second "sleep 1000" waits for 1 sec (1000 milliseconds) before executing the last command which activates the command window so I could continue typing without interruption. The semicolon at the end aslo functions as an instruction to execute the command. Try removing it and see what happends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment