You can flag training samples by -generate byte training = (uniform() < X)-,
where X is the percentage of the total dataset that you want to use for
training. So, for example, if you want to use 33% for training and keep the
remaining 67% for holdout, then the commands would be:
set seed <seed>
generate byte training = uniform() < 0.33
<command> if training
Joseph Coveney
----------------------------------------------------------------------------
sgsr100 wrote:
>Hi,
>Do you know how can a get a training sample randomly chosen from stata
>and how can I keep the remaining observations as a holdout sample.
>Thanks,
>Sandra
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/