Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Ignore accents while sorting international characters


From   John LeBlanc <[email protected]>
To   Svend Juul <[email protected]>, <[email protected]>
Subject   Re: st: Ignore accents while sorting international characters
Date   Wed, 18 Jun 2008 19:12:57 -0300

Thanks; I was hoping that Stata had a built-in option to ignore accents. Some software with sort routines have the ability to give characters with diacritical marks the same value as their own. Is this not an issue for non-English Stata users? Is there sufficient desire to justify asking stata for this feature, e.g., as an option to gsort?


John 

On Wed, 18 Jun 2008 12:53:14 +0200, Svend Juul wrote:

John LeBlanc wrote:

How does one ignore accents while sorting international characters?

sort & gsort deliver this:

ecole
school
�cole

What I'd like is this:
ecole
�cole
school

============================================================

I believe that you must generate a second variable with no accents
to get it right:

    gen str10 key2=key
    replace key2 = subinstr(key2,"�","e",.)
    replace key2 = subinstr(key2,"�","o",.)
    ...
    sort key2 key

I included key as a secondary sort key to make � come after e.

Hope this helps
Svend

__________________________________________

Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6
DK-8000  Aarhus C, Denmark
Phone:  +45 8942 6090
Home:   +45 8693 7796
Email:  [email protected]
__________________________________________

*
*   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/

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