Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: programming and quotation


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: programming and quotation
Date   Tue, 17 Feb 2004 17:23:41 -0000

The problem is that the backslash has different 
interpretations. To you, and to Windows, it is 
a separator which helps to indicate where a file
is. To Stata, it also has a different interpretation
as explained at [U] 21.3.10.

The best advice is to think Unix and use forward
slashes. Stata understands what you mean and will
translate to Windows. 

Nick 
n.j.cox@durham.ac.uk 

Jitian Sheu
 
> 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"?

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