Thank you, Timothy.
The last line does not work and returns an error [either r(603) or
r(198)depending on how I write the macro ](see below). All rest works
well. Indeed, the directory is created.
******************* BEGIN: test1.do
local name = "test_directory"
cd C:\
mkdir "`name' "
// my do file
save "C:\`name'\current_data.dta"
******************* END: test1.do
It shows up:
file C:`name'\current_data.dta could not be opened
r(603);
******************* BEGIN: test2.do
local name = "test_directory"
cd C:\
mkdir "`name' "
// my do file
save "C:\"`name'"\current_data.dta"
******************* END: test2.do
It shows up:
invalid 'test_directory'
r(198);
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/