Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Swor and sample commands


From   karoline mortensen <[email protected]>
To   [email protected]
Subject   st: Swor and sample commands
Date   Thu, 22 May 2003 11:12:51 -0400 (EDT)

Hi,

I would like to randomly select (without replacement) 5% of my data, and
keep all the data that were not selected. I believe this rules out the
Stata "sample" command, because that discards the 95% of observations that
were not selected.

In other analyses I have used the very useful "swor" command (which allows
the option of keeping non-selected observations). However, now I want to
randomly select 5% (not an absolute count) of my observations, by an ID
variable, so 5% of each ID get selected. Swor seems to only allow an
absolute count to be selected. Is there another option that allows me to
randomly sample a certain percentage, while keeping all the observations
in the dataset?

Thanks in advance,
-Karoline Mortensen



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



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