So here I am trying to make a global date instead of local (which works for each separate file.) since I am using the same syntax in multiple files. The local syntax for this works perfectly fine. however, when I using the same syntax to make it a global then its not capturing the date while exporting.
** FOR GLOBAL
global today = date("`c(current_date)'", "DMY")-1
display `today'
global today_str: disp %tdm_D `today'
global today_dashes: disp %tdYY-Mon-DD `today'
global today_dashes = "20`today_dashes'"
** FOR LOCAL
local lastday = date("`c(current_date)'", "DMY")-1
local lastday_str: disp %tdm_D `lastday'
local lastday_dashes: disp %tdYY-Mon-DD `lastday'
local lastday_dashes = "20`lastday_dashes'"
* Use the global macro in the export command
export delimited "$audioscrutiny/audio_scrutiny_$today_dashes", replace
*Use the global macro in the export command
export delimited "$audioscrutiny/audio_scrutiny_`lastday_dashes', replace
Below we can see that the files generated using local has dates but the global one has a missing date info. How can I fix this issue of global date?

** FOR GLOBAL
global today = date("`c(current_date)'", "DMY")-1
display `today'
global today_str: disp %tdm_D `today'
global today_dashes: disp %tdYY-Mon-DD `today'
global today_dashes = "20`today_dashes'"
** FOR LOCAL
local lastday = date("`c(current_date)'", "DMY")-1
local lastday_str: disp %tdm_D `lastday'
local lastday_dashes: disp %tdYY-Mon-DD `lastday'
local lastday_dashes = "20`lastday_dashes'"
* Use the global macro in the export command
export delimited "$audioscrutiny/audio_scrutiny_$today_dashes", replace
*Use the global macro in the export command
export delimited "$audioscrutiny/audio_scrutiny_`lastday_dashes', replace
Below we can see that the files generated using local has dates but the global one has a missing date info. How can I fix this issue of global date?
Comment