stata-economics
stata-economics copied to clipboard
Introduce how to write comments in .do files
Hi~I hope I didn't misunderstand this prompt. For writing comments, I commonly use three different marks: /**/, //, *. I think there are also some tricks to make the do-files readable. There are four things I usually do:
- At the beginning of the do-file, I list the updated date, the goal, and the structure of this do-file.
- I use a whole line of * to separate each "chapter" of the do-file.
- I use // to write the purpose of some lines if it is not straightforward.
- I use /**/ to save the results of some important lines below the lines themselves. For example, I will store the results of _merge for future reference without rerunning the codes.
Those tricks are very personalized. It might be too redundant. But it should be helpful for archiving finished projects. It might take a while to review a small part of the codes without comments.
Thank you!
Thank you, @yuanyuan0314 . Do you want to add this to https://github.com/datacarpentry/stata-economics/blob/main/_episodes/05-programming.md and submit a pull request?