<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: random seed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230511#M268062</link>
    <description>&lt;P&gt;Follow Rick's advice and use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data rn;
	call streaminit(10);
	a = rand("NORMAL");
	b = a;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 18 Oct 2015 21:31:37 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2015-10-18T21:31:37Z</dc:date>
    <item>
      <title>random seed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230504#M268059</link>
      <description>&lt;P&gt;Why do I get different results for variable a and variable b even though I use same random seed 10 for the two variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data rn;
	a=rannor(10);
	b=rannor(10);
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 20:08:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230504#M268059</guid>
      <dc:creator>Nichlas</dc:creator>
      <dc:date>2015-10-18T20:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: random seed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230505#M268060</link>
      <description>&lt;P&gt;Please read Rick Wicklin's blog entry on this topic&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html" target="_blank"&gt;http://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 20:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230505#M268060</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-18T20:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: random seed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230507#M268061</link>
      <description>&lt;P&gt;Thanks, it's because in a data step, the first seed encountered will determine the whole stream, right?&lt;/P&gt;
&lt;P&gt;Another question, then can I write&lt;/P&gt;
&lt;PRE&gt;b=rannor&lt;/PRE&gt;
&lt;P&gt;without&amp;nbsp;assigning a seed for the second variable since whatever seed set to b would prove to be useless?&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 20:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230507#M268061</guid>
      <dc:creator>Nichlas</dc:creator>
      <dc:date>2015-10-18T20:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: random seed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230511#M268062</link>
      <description>&lt;P&gt;Follow Rick's advice and use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data rn;
	call streaminit(10);
	a = rand("NORMAL");
	b = a;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Oct 2015 21:31:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/230511#M268062</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-10-18T21:31:37Z</dc:date>
    </item>
    <item>
      <title>Re: random seed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/231178#M268063</link>
      <description>&lt;P&gt;In your example, it doesn't matter what seed value you use for b. You will always get&lt;/P&gt;
&lt;TABLE class="table" rules="all" frame="box" cellspacing="0" cellpadding="5" summary="Procedure Print: Data Set WORK.B"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="r data"&gt;a=0.84963&lt;/TD&gt;
&lt;TD class="r data"&gt;b=0.70089&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A random number seed initializes a sequence of pseudorandom values. For the RANUNI function (and other RAN* functions), the first time you use a seed&amp;nbsp; determines the sequence for the rest of the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are two related articles:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2012/01/30/random-number-seeds-only-the-first-seed-matters.html" target="_self"&gt;Random number seeds: Only the first seed matters&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/iml/2011/08/31/random-number-streams-in-sas-how-do-they-work.html" target="_self"&gt;Random number streams in SAS: How do they work?&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My mental model for a stream is this: I have a spiral notebook with thousands of sheets of papers.&amp;nbsp; On each page, I write down a sequence of random numbers.&amp;nbsp; The first sheet can have the same numbers as another sheet, but they are in different orders.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The "seed" corresponds to a page. When you want a sequence of random numbers, you tell me what page you want.&amp;nbsp; I then read off the numbers on that page one at a time.&amp;nbsp; If you want a different sequence, you need to ask for a different page.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 14:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/random-seed/m-p/231178#M268063</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-10-22T14:47:52Z</dc:date>
    </item>
  </channel>
</rss>

