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: Stata does not understand some strings


From   Pablo Bonilla <[email protected]>
To   statalist <[email protected]>
Subject   st: Stata does not understand some strings
Date   Fri, 4 Oct 2013 12:19:38 -0400

Dear Statalist,



I have a problem the following problem: I wrote a program that is
meant to remove all special Spanish accents from strings so I can have
a clean sentence to compare it with other strings. My program has the
following lines:



***************

local unos "á é í ó ú ñ Á É Í Ó Ú Ñ ü"

local doss "a e i o u n a e i o u n u"



forvalue i = 1(1)13 {   // Loop to replace accents from Spanish

                        local uno : word `i' of  `unos'

                        local dos : word `i' of   `doss'

                        local label :       subinstr local label
"`uno'" "`dos'", all

}

******************

However it is not replacing the accents because, when I looked at the
trace, Stata is understanding something totally different. Like this:

***********************

      - local unos "á é í ó ú ñ Á É Í Ó Ú Ñ ü"

      - local doss "a e i o u n a e i o u n u"

      - forvalue i = 1(1)13 {

      - local uno : word `i' of `unos'

      = local uno : word 1 of á é í ó ú ñ Á É Í Ó Ú Ñ ü

      - local dos : word `i' of `doss'

      = local dos : word 1 of a e i o u n a e i o u n u

      - local label : subinstr local label "`uno'" "`dos'", all

      = local label : subinstr local label "á" "a", all

      = local label0 : subinstr local label0 "á" "a", all

-          }

************************

As you can see Stata reads “á”  instead of “á” and so on. Do you have
any idea why it is happening? And, more importan, do you know how to
solve it ?



Thank you so much.


-- 
----

Pablo Bonilla

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


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