Statalist


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

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


From   "sdm1" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Strings and the greater than/less than operators
Date   Wed, 13 May 2009 17:59:38 +0100

Noooooooooooo!  

Thanks Nick...and, of course, you're dead right.  

The giveaway, I realise now, is the alignment of the values of code under
the heading 'code' in the tabulation.  I think that the last character
aligns vertically with the 'e' of 'code'.

The only bit I don't understand is: "The order is that of -char()-".  

It sounds to me as if char is user defined.  This is from the help for char:

 The dataset itself and each variable within the dataset have associated
with them a set of characteristics.
    Characteristics are named and referred to as varname[charname], where
varname is the name of a variable or _dta.
    The characteristics contain text.  Characteristics are stored with the
dataset in the Stata-format .dta dataset,
    so they are recalled whenever the dataset is loaded.

If characteristics for a variable are not defined by the user, what's the
default order?  Is there a list somewhere which will tell me the order in
which Stata sorts characters e.g. alphabetric, numeric, spaces, etc.  Or am
I misinterpreting here?

Once again, thanks for your help.

Steve

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: 13 May 2009 17:26
To: [email protected]
Subject: st: RE: Strings and the greater than/less than operators

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

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

Nick
[email protected] 

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/

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