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]

Re: st: Randomly change a date in Stata


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Randomly change a date in Stata
Date   Tue, 19 Jun 2012 11:18:08 +0100

A random integer from a discrete uniform on the integers [-5,5] is

ceil(11 * runiform()) - 6

so you just add that, or equivalently subtract it. -set seed- first
for reproducibility.

Nick

On Tue, Jun 19, 2012 at 10:58 AM, Tim Evans <[email protected]> wrote:

> I have dates of birth which for the purpose of anonymity in a dataset, I wish to generate a new 'annoynmised date of birth' whereby for a list of dates, I randomly add or subtract up to 5 days and generate the new date. Does anyone have a suggestion as to how I might do this in Stata?
>
> I'm using Stata 11.2 and the dates are in date format (i.e. not strings).

*
*   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