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

st: RE: Stata vs. SAS (random number generation)


From   "Thuy Le" <tl6775a@american.edu>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Stata vs. SAS (random number generation)
Date   Wed, 06 Apr 2005 17:48:56 -0400

That's impossible and against the so-called "randomn". If even when you try
to repeat the same command in STATA, you get different sequence each time.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joao Pedro Wagner
de Azevedo
Sent: Wednesday, April 06, 2005 5:12 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: Stata vs. SAS (random number generation)

Dear Statalist,

I would like to know if it is possible, and if so how, to have Stata and SAS
generating the same sequence of random numbers. 

I've tried setting the same seed value in both packages with no success (see
example of the command and output below).

Any help will be much appreciated.

Cheers,

JP


*************** command ***************

Stata command
set seed 1
g z1 = uniform()
set seed 2
g z2 = uniform()

SAS command
Z1=UNIFORM(1);
Z2=UNIFORM(2);


*************** output ***************

SAS					STATA		
seed	1	2			seed	1	2
N	Z1	Z2			n	z1	z2

1	0.18496	0.97009			1	0.6681852	0.850512
2	0.39982	0.2594			2	0.9279611	0.0515642
3	0.9216	0.96928			3	0.4844814	0.6303533
4	0.54298	0.53169			4	0.469739	0.6991696
5	0.04979	0.06657			5	0.9726482	0.518447
6	0.81932	0.52387			6	0.5563972	0.3360431
7	0.85339	0.06718			7	0.8156933	0.1747266
8	0.95702	0.29719			8	0.8364499	0.9104601
9	0.27261	0.68993			9	0.5807183	0.3874338
10	0.97676	0.22651			10	0.3767964	0.409848
11	0.68824	0.41276			11	0.1186234	0.9596469
12	0.55855	0.28723			12	0.5055883	0.1529711


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

-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005
 

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.9.3 - Release Date: 4/5/2005
 


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