Statalist


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

st: RE: Strings and the greater than/less than operators


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Strings and the greater than/less than operators
Date   Wed, 13 May 2009 17:25:56 +0100

General question: Absolutely. The order is that of -char()-. 

Specific question: "N05 " > "N05". You have trailing spaces. They are
characters too. 

Nick 
n.j.cox@durham.ac.uk 

Steve 

Can the greater than (>) and less than (<) operators be applied to
strings?

If the answer is 'yes' (as I thought), why is "N05" included in the
output
for the following command? 

. tab code admimeth if (admimeth==31 | admimeth==32) & (code>"N05" &
code<"N13")

           |       admimeth
      code |        31         32 |     Total
-----------+----------------------+----------
      N05  |       103        163 |       266 
      N06  |    23,858        132 |    23,990 
      N07  |   364,687      2,653 |   367,340 
      N08  |     8,079         18 |     8,097 
      N09  |    70,953        132 |    71,085 
      N10  |    24,606         88 |    24,694 
      N11  |   123,635        256 |   123,891 
      N12  |   546,148     21,998 |   568,146 
-----------+----------------------+----------
     Total | 1,162,069     25,440 | 1,187,509 


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