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

RE: st: RE: problem referencing certain characters


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: problem referencing certain characters
Date   Mon, 25 Nov 2002 09:10:40 -0500

> Nick,
> Thanks for your suggestions.
> The quote characters work fine for me too in that same 
> context, but for
> some reason, within my dofile the exact same code produces the r(612)
> error, "unexpected end of file."
>      replace `var' = subinstr(`var',`"""',"",.);
> That peice of code is in a series of replace commands within 
> a for loop.
> when i comment out that single line it works fine...otherwise 
> i get that
> error.

The following code works fine for me, as part of a 'do' file:

	clear
	set obs 1
	gen str10 x= `"abc"def"'
	gen str10 y= `"abc"def"'
	list
	foreach var in x y {
		replace `var' = subinstr(`var',`"""',"",.)
	}
	list

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