Documenting your work
Stata provides several opportunities to document your work. You can describe your variables in more detail than is possible with the variable name using the label variable command. You can attach one or more words to each value of a variable using the label values command. These variable and value labels will be displayed in the results of Stata commands that support them.
The do-file is the best place to document how you created your variables or cleaned your data. Not only is the code there, allowing you or others to reproduce your work, but you can also add explanations and keep a record of decisions about how decisions were made. You can start with this do-file template to create a format that suits your needs.
After creating your analysis file, or if you have a data file for public dissemination, you might want to create a codebook using the cb2html command. This command allows you to add much more information to your codebook about each variable, the data set, and even the questionnaire, using the Stata note command. Such information might include the algorithm you chose and the decisions you made in creating a new variable. For survey data, they might include the skip instructions to the interviewer to help the data user understand the pattern of missing values. If you are not using CPC's network, you'll need to download this command from the SSC archive:
ssc install cb2html