Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: mkdir with local


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: mkdir with local
Date   Tue, 18 Sep 2007 18:58:31 -0400

Tiago says
I would like to generate a new directory inside Stata and to save data
using a local macro. For example:

local name = "test_directory"
cd C:\
mkdir "`directory ' "
// my do file
save "C:\`name'\current_data.dta"



However, last line does not work. Is it possible to do that?

No, not possible if you stick with the DOS \. But turn it the other way and Stata will stop interpreting it as an escape character. That is,

save "C:/`name'\current_data.dta"

Stata can always use *nix-style / where Winodws uses \, and will send the appropriate name to Windows.

Kit


Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html

*
* 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/




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index