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

st: re: mkdir with local

From   Kit Baum <[email protected]>
To   [email protected]
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 Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

* For searches and help try:

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