Statalist


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

Re: st: random draw of single variable, not whole data


From   Steven Samuels <[email protected]>
To   [email protected]
Subject   Re: st: random draw of single variable, not whole data
Date   Thu, 26 Feb 2009 14:17:27 -0500


*******************
sysuse auto,clear
save d01, replace
keep mpg
bsample _N
rename mpg y
merge using d01
******************

Why do you want to do this? Why have the new "y" paired with an unrelated existing observation? Perhaps -bootstrap- will meet your real need.

-Steve

On Feb 26, 2009, at 2:00 PM, Florian Wakolbinger wrote:

Dear all,

is it possible to randomly draw numbers out of a variable x and write it into another variable y

i.e. if

x
1
2
3
4
5

then y could be, for instance

y
3
5
3
2
4

all numbers in y are randomly drawn from x. how is it possible to construct such a variable y in stata?

thanks, and kind regards
florian


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index