Posted on 28 August 2010 by Mitch Abdon
-help- is the most important (and, of course, the most helpful) Stata command. It is therefore fit to honor -help- by making it this blog’s first entry. What can you expect from -help-? What can’t you get out of it?
Suppose, you have an N-digit numeric variable that you want to split into two — the first n digits and the last (N-n) digits. You know that you need to instruct Stata to, first, turn the numeric variable into string; and second, to divide the string into two. But you have no idea how to tell Stata what to do. (See also Preserving numerical format after string transformation and Truncating numbers for more detailed discussion on how to split strings or numerical codes.)
Like in any programming language, it is garbage-in-garbage-out in Stata. If you feed Stata the wrong instruction or something that it does not understand, it will spit out the wrong answer and something that you don’t understand either.
-help- is the way to start to learn Stata’s language. Its syntax is straight forward:
This command instructs Stata to open a new window that shows you the syntax of the string function and points you to links to the more detailed string functions. You can then browse through these links and, at some point, will be able to find the functions -destring- and -substr-.
You may write whatever you want as keyword, but always keep in mind that only keywords that make sense help; anyway, the worst that can happen is that Stata will tell you it could not find your keyword anywhere–official help files, Stata’s FAQ, Stata Journal, Stata Technical Bulletin (STB), etc. For example, try “help gini.” Of course “gini” is a good keyword if you are looking for functions that return measures of inequality such as the gini coefficient. But you will find that Stata will not lead you right to a function, but will prompt, “A help file for gini was not found. Do you wish to do a keyword search on ‘gini’?” If you say ‘yes’ (this is the same as typing “search gini”), Stata will lead you to a number of links related to gini, like ‘sg104′ or ‘sg130′ (sg is a code for STB articles that generates statistics). Another example is help yaxis, for which Stata will categorically say, “No entries found for search ‘yaxis’.” This does not mean that Stata cannot provide any help on how to control y-axis of graphs. It only means that the keyword “yaxis” does not mean anything to Stata. Try help graph, instead.
If -help- fails, there is always Google search.