Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: AW: Identifying unique values with codebook


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: Identifying unique values with codebook
Date   Wed, 16 Jun 2010 15:26:18 +0200

<> 

As -help data_types- says: "doubles have 16 digits of accuracy." So you can
increase the digits of your "y" up to the point where even -double- can do
nothing for you:

*************
clear
set obs 10
gen byte x=_n
codebook x
gen double y1 = 1000000000000000 + x
gen double y2 = 10000000000000000 + x
gen double y3 = 100000000000000000 + x
gen double y4 = 1000000000000000000 + x
codebook y?
ins y?
*************


Interestingly, -inspect- seems to differ from -codebook-`s opinion.


HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Walter
Garcia-Fontes
Gesendet: Mittwoch, 16. Juni 2010 15:13
An: Statalist
Betreff: st: Identifying unique values with codebook

I stumped into a problem when identifying unique values of a numeric
variable using "codebook": if the values are large they will be
identified as the same value.  

For instance I have a variable x with the following values:
0, 1, 2, ... 10 (that is 10 different values)

codebook x 
reports "unique values: 10"

Now do 
gen y = 100000000000000000 + x

codebook y
reports "unique values = 1"

Is this a feature?

-- 
Walter Garcia-Fontes
mailto: [email protected] - http://puna.upf.edu
Departament d'Economia i Empresa - http://www.econ.upf.edu
Universitat Pompeu Fabra
Ramon Trias Fargas 25-27, 08005 Barcelona, Spain
Tel. +34 93 542 2722 - Fax. +34 93 542 1746

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index