Stata uses the \ character to indicate not to expand a macro when
interpreting a line. Rather than try to deal with \\ or other work arounds,
it seems fastest to just always use the / character in specifying paths (it
works on all platforms).
Michael Blasnik
[email protected]
----- Original Message -----
From: "Jitian Sheu" <[email protected]>
To: <[email protected]>
Sent: Tuesday, February 17, 2004 12:07 PM
Subject: st: programming and quotation
> I have a question.
> I want to run couple regressions and save results using -outreg- with
> different out file.
>
> the programming I wrote is as following:
>
> ******CODE (1)****************
> foreach var in var1 var2 var3 var4{
>
> reg `var' x1 x2 x3.....
> outreg using c:\temp\`var'.out, replace
> }
> ******CODE (1) END here****************
>
> Initially, I hope to save the results (var*.out) in the folder of
"C:\temp\"
>
> However, the above command save all results as: temp.out in the C-drive
> (i.e. C:\), instead of c:\temp\
>
>
> So, I use -set trace on- to see what's going on.
> Then, I change the above code a littel bit as following:
>
>
> ******CODE (2)****************
> foreach var in var1 var2 var3 var4{
>
> reg `var' x1 x2 x3.....
> outreg using c:\temp\\`var'.out, replace
> }
> ******CODE (2) END here****************
>
>
> i.e. I put doulbe "\\" between "temp" and "`var'.out"
> And then it works
> i.e. I finally get results file under c:\temp\, instead of c:\
>
>
> But, then the problem is that I don't see anything wrong inc the CODE (1)
> program.
> What under Code(1), the out-file will be saved in "C:\" instead of
> "c:\temp"?
>
>
> Thanks
>
> jt
*
* 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/