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

From |
"sdm1" <sdm1@york.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Thu, 14 May 2009 15:45:42 +0100 |

That's really helpful. Thanks Nick. Steve -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 14 May 2009 15:35 To: statalist@hsphsun2.harvard.edu Subject: st: RE: RE: RE: RE: RE: RE: Strings and the greater than/less than operators It seems so. Stata sorts strings as a dictionary would, except for the order of its alphabet. If you want to sort strings on their numeric content, create a sort key variable with just that numeric content. In simple cases, -destring- will suffice, but with attention to its options. Nick n.j.cox@durham.ac.uk sdm1 I was thinking about sorting strings in the same way as one would sort numerics so that, for example, a four digit integer is always greater than a three digit integer. Clearly I shouldn't think like this when it comes to strings because "N12 " is less than "N13" and, although 1234 is greater than 124, "1234" is less than "124". When thinking about the sort order of strings, would it be sensible to think of them being left aligned (whereas with integers they're right aligned)? * * 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/ * * 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/

**References**:**st: Strings and the greater than/less than operators***From:*"sdm1" <sdm1@york.ac.uk>

**st: RE: Strings and the greater than/less than operators***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: RE: RE: Strings and the greater than/less than operators***From:*"sdm1" <sdm1@york.ac.uk>

**st: RE: RE: RE: Strings and the greater than/less than operators***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**st: RE: RE: RE: RE: Strings and the greater than/less than operators***From:*"sdm1" <sdm1@york.ac.uk>

**st: RE: RE: RE: RE: RE: Strings and the greater than/less than operators***From:*"sdm1" <sdm1@york.ac.uk>

**st: RE: RE: RE: RE: RE: RE: Strings and the greater than/less than operators***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: RE: RE: RE: RE: RE: Strings and the greater than/less than operators** - Next by Date:
**Re: st: "time ratios" and "hazard ratios"** - Previous by thread:
**st: RE: RE: RE: RE: RE: RE: Strings and the greater than/less than operators** - Next by thread:
**st: sample size estimates for multilevel models** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |