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

st: file wrote single opening quote


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   st: file wrote single opening quote
Date   Mon, 18 Nov 2002 15:43:17 +0000

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?

uli


-- 
[email protected]
http://www.sowi.uni-mannheim.de/lesas

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index