Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Maarten Buis <maartenlbuis@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: sum issue (wrong values) |

Date |
Wed, 24 Oct 2012 12:32:33 +0200 |

On Wed, Oct 24, 2012 at 12:13 PM, Christian Bärtsch wrote: > I have a issue using the sum function of STATA. I have a data set, > where I have a variable called latency_int (type: int; and something > over 5700 values). I use the command sum(latency_int). There I get the > minimum of 2 and the maximum of 1999 even though the data set contains > values from 44 to 81000 (those values are shown when I use > list(latency_int). I suspect that you have value labels for the variable latency_int, and that that is the stuff you see when you type -list latency_int-. However, sum() uses the actual values and not the labels. To see how this might work, see: *----------- begin example ----------- // sum seems to work clear all set obs 10 gen x = _n list gen sumx = sum(x) list // now it looks wrong label define x 1 "100" label value x x drop sumx gen sumx = sum(x) list // but now it looks correct again list, nolabel *------------ end example ------------ (For more on examples I sent to the Statalist see: http://www.maartenbuis.nl/example_faq ) -- Maarten --------------------------------- Maarten L. Buis WZB Reichpietschufer 50 10785 Berlin Germany http://www.maartenbuis.nl --------------------------------- * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**st: sum issue (wrong values)***From:*Christian Bärtsch <christian.baertsch@student.unisg.ch>

- Prev by Date:
**Re: st: sum issue (wrong values)** - Next by Date:
**Re: st: sum issue (wrong values)** - Previous by thread:
**Re: st: sum issue (wrong values)** - Next by thread:
**Re: st: sum issue (wrong values)** - Index(es):