Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: handling the quote character stored in a string variable


From   Charles Vellutini <charles.vellutini@ecopa.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: handling the quote character stored in a string variable
Date   Mon, 9 Jan 2012 06:23:37 -0800

Dear Statalisters,

I have a string variable ("marqueur" in the code below) which contains a single quotation mark for certain observations (the data is from Google's Adwords and keywords are enclosed in quotation marks when the correspondence type is based on the exact expression). However, Stata rejects a test on the quotation mark used as a character.  I get the error message "too few quotes" when I run the following code:

      gen type_corr = "expression" if marqueur_type2 == """

and the data is like this :


                               marqueur

obs 1                     [

obs 2                     "

obs 3                     r

obs 4                     "

etc.

Any idea on how to run tests on the quotation mark stored in a string variable ?

Thanks,

Charles



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index