I would do something like this if you want your regressions bundled together:
local append "replace"
foreach X in x y z {;
reg a `X;
outreg using "D:/filename.out", title("Reg of a on `X'") bdec(4)
coefastr se 3aster addnote("Note here") `append';
local append "append";
};
If you want them separately, do
local append "replace"
foreach X in x y z {;
reg a `X;
outreg using "D:/`X'.out", title("Reg of a on `X'") bdec(4) coefastr
se 3aster addnote("Note here") `append';
local append "append";
};
The problem with using a backslash in the path name is that it has
special meaning when combined with a single quote. It means don't
expand the macro, which is why you're running into a problem.
DVM
*
* 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/