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

st: RE: file wrote single opening quote

From   "Nick Cox" <>
To   <>
Subject   st: RE: file wrote single opening quote
Date   Mon, 18 Nov 2002 15:03:34 -0000

Ulrich Kohler
> Is there a way to wrote a single opening quote to a file 
> with -file wrote-? 
> In a program I have the command 
>    file write texfile `"`line'"'
> which wrotes the contents of the local macro `line' to the 
> file handle 
> "texfile". The command works well except for lines which 
> contains either a 
> local macro name (like `a') , or a single opening quote. In 
> the first case 
> Stata expands the local macro name to the contents of the 
> local macro. But I 
> want to have the local macro name (`a') in my file handle. 
> In the second case 
> I got an error message because Stata thinks that there 
> should be a valid 
> local macro name, which is not there.
> I tried to escape each occurence of the single opening 
> quote with the 
> backslash by substituting ` with \`. But 
>    local line: subinstr local line `"`"' `"\`"'
> does not work for obvious reasons.  What else could be done?

use _char(96) 

*   For searches and help try:

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