Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: data manipulation


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: data manipulation
Date   Tue, 9 Nov 2004 14:53:09 -0000

There are several ways to test whether 
a value is an integer. An integer is 
the same as its floor and its ceiling 
and also x == int(x). So 

if x == int(x) 

and 

if x != int(x) 

are two such tests. 

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

Nahid

> I have a simple question. I have a column (x) with integer 
> and non-integer values, such as 2, 2.03. 1, 1.8, .... I want 
> to use this column to identify each record by referring to 
> the integer and alternatively non-integer values. How do I 
> refer to them?
> 
> for example:
> 
> 'an expression'  if x==integer values
> 'another expression'  if x ~=integer values
> 
> In these two examples how do I identify the integer and 
> non-integer values?

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