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

st: Re: programming and quotation


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: programming and quotation
Date   Tue, 17 Feb 2004 12:28:11 -0500

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
michael.blasnik@verizon.net

----- Original Message ----- 
From: "Jitian Sheu" <jtsheu@bu.edu>
To: <statalist@hsphsun2.harvard.edu>
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/



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