[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: generating a sequence of numbers in Mata

From   Kit Baum <>
Subject   st: Re: generating a sequence of numbers in Mata
Date   Tue, 2 Oct 2007 06:36:07 -0400

I looked for the built-in function before answering this question, but could not find it. But Le Wang need not write his own;

help mata range()
help mata rangen()

Thanks to Ben Jann for pointing that out.

Kit Baum, Boston College Economics and DIW Berlin
An Introduction to Modern Econometrics Using Stata:

On Oct 2, 2007, at 2:33 AM, statalist-digest wrote:

Le Wang wonders why his Mata routine comes up one short some of the
time. Just the usual finite-precision-arithmetic problem: remember
that 0.1 is an irrational number in binary, so that adding it up 19
times does not necessarily give you exactly 1.90. Replace the line
computing the number of points with

	n=ceil((to-from)/increment) +1 /* Number of points*/

and it should work.
*   For searches and help try:

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