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

st: RE: some code that doesn't do what I expect


From   Jesper Kjr Hansen <kjaer.hansen@oncable.dk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: some code that doesn't do what I expect
Date   Tue, 8 Mar 2005 14:15:47 +0100

Phil,

used in this context the backslash (\) prevents macro substitution.

In this case, just use (/) instead.

Also, see the FAQ on this:
http://www.stata.com/support/faqs/lang/backslash.html


/Jesper



Kind regards,

Jesper Kjr Hansen
Student Assistant
Department of Statistics
University of Southern Denmark

*******************************
mailto:kjaer.hansen@oncable.dk 
mailto:kjaer.hansen@get2net.dk 
********************************
 

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu 
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of 
> Philip Greenwood
> Sent: Tuesday, March 08, 2005 6:55 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: some code that doesn't do what I expect
> 
> I ran a do file that did something that I did not expect it 
> do. Perhaps
> someone would like to try to reproduce this behaviour, or point out my
> mistake. I'm running Stata 8.2 on WinXP. Here's the log:
> 
> *--snip--
> 
> . do "test01"
> 
> . version 8
> 
> . use "data\sndata.dta"
> 
> . local foo "a_great_big_fish"
> 
> . save "data\`foo'.dta"
> file data`foo'.dta saved
> 
> .
> end of do-file
> 
> *--snip--
> 
> I expected `foo' to evaluate to "a_great_big_fish" in the 
> save command.
> Using a double slash fixes the problem ( i.e. -save 
> "data\\`foo'.dta"- ).
> 
> cheers,
> Phil
> 
> 
> 
> *
> *   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/
> 


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