Remembering what that Do file is for !
I have lost count of how often did I get confused when revisiting a DO file couple of months later ? Gradually, I have developed the following as a method of minimizing the confusion –
cd "D:\Work\ProjectName\DataDirectory"
capture log close
log using "results1.smcl", replace
use "Data1.dta", clear
save "Data2.dta", replace //Immediately Save to Avoid overwriting original data
cls
// DATE CREATED:
// PURPOSE
// DATE UPDATED:
// EDITS DONE:
************ DATA MANAGEMENT ***********
****************************************
save "Data2.dta", replace
cap log close
view "results1.smcl"
Code language: JavaScript (javascript)
I think its quite obvious. Still what were are doing is:
- Entering our work directory
- Closing any open LOGs
- Opening a new LOG file
- Opening a Data File and IMMEDIATELY saving it as NEW data file.
- Clearing output screen
- Stating initial purpose of file with date. A couple of sentences go a long way in the long run
- Adding dates that the file was edited after initial freezing and the purpose of edits. Maintining Audit trail is vital.
- Do the Data management / Analysis
- Save the Data file
- Close the Log file and view the logs