- Generate datetime string to use as filenames
fname = paste(format(Sys.time(), "%Y%m%d-%H%M%S"), ".EXT", sep="")
You might be quite suprised if you are new to stata and just realized that stata use the same random seed for every startup. To see this, type display c(seed)
. This is to see, if you dont set the seed, you are useing the SAME random data for all your research life.
I find my self very willing to add the following line to my profile.do
. This is not a perfect solution but what I can get from within stata is limited. Well, better than noting anyway.
set seed `= clock("`c(current_date)' `c(current_time)'","DMYhms")/1000'
`: display %tCCCYY-NN-DD-HH-MM-SS Clock("`c(current_date)' `c(current_time)'","DMYhms")'
This code will generate a string like 2014-01-28-15-24-30
, you can use this to save a file, eg save ...
(replace the ...
with the code above).
Add the following to your profile.do
log using PATH/TO/LOG/`: display %tCCCYY-NN-DD-HH-MM-SS ///
Clock("`c(current_date)' `c(current_time)'","DMYhms")', ///
name(default_log_file) text