Hi
I would like to use local date macros to create date-stamped file names for my log files and datasets. Creating them seems to have been straightforward so far, using the code below:
However, when I then want to retrieve today's .dta file later, using the code below, I get the error message "file studyinfo_.dta not found" - so the macro doesn't seem to be being recognised? This is important as I am switching between multiple .dta files in each do file.
Is it possible to combine the use command and a local macro, as I am trying to do?
(I have a feeling there is a simple answer to this but have struggled to find one online, partly I think because the question involves the ubiquitous term "use"...)
Thanks very much
Emily
I would like to use local date macros to create date-stamped file names for my log files and datasets. Creating them seems to have been straightforward so far, using the code below:
Code:
**create local date macro for naming files di "$S_DATE" local date = daily("$S_DATE", "DMY") di "`date'" di %tdCY-N-D 20418 local date : di %tdCY-N-D daily("$S_DATE", "DMY") di "`date'" save studyinfo_`date'.dta, replace
Code:
use studyinfo_`date'.dta, clear
(I have a feeling there is a simple answer to this but have struggled to find one online, partly I think because the question involves the ubiquitous term "use"...)
Thanks very much
Emily
Comment