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

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
Nick Cox <njcoxstata@gmail.com> |

Subject |
Re: st: how to generate a variable where one third of values would be randomly assigned |

Date |
Mon, 12 Dec 2011 15:59:56 +0000 |

-ceil()- should be -floor()- On 12 Dec 2011, at 15:39, Nick Cox <njcoxstata@gmail.com> wrote:

gen foo = cond(runiform() < 1/3, ceil(120 * runiform()), 120) ? NickOn 12 Dec 2011, at 15:04, Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk> wrote:Dear all,I use stata 11 and I need to generate a variable where two thirdsof observations (about 1300 obs) will be equal to 120 and the restof the values are randomly assigned, but are all integers and lessthan 120.Any advice will be very much appreciated, Ekaterina * * 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/

**References**:**st: how to generate a variable where one third of values would be randomly assigned***From:*Ekaterina Hertog <ekaterina.hertog@sociology.ox.ac.uk>

**Re: st: how to generate a variable where one third of values would be randomly assigned***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**Re: st: how to generate a variable where one third of values would be randomly assigned** - Next by Date:
**st: RE: FW: Re: xtmixed slope cross validation** - Previous by thread:
**Re: st: how to generate a variable where one third of values would be randomly assigned** - Next by thread:
**Re: st: how to generate a variable where one third of values would be randomly assigned** - Index(es):