<?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: Loop/Macro to Iterate Seed of Random Value Generator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370054#M275641</link>
    <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2017 17:58:45 GMT</pubDate>
    <dc:creator>PBG</dc:creator>
    <dc:date>2017-06-23T17:58:45Z</dc:date>
    <item>
      <title>Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/369981#M275633</link>
      <description>&lt;P&gt;I have this code which, given an input covariance matrix, randomly draws 1000 values for each of four&amp;nbsp;normally-distributed variables. It's easy enough to change the seed manually to generate another set of 1000 random variable values, but I'm looking to create 1000 or more of these such sets, and to average them together. Can this be done&amp;nbsp;with a sort of loop or macro?&amp;nbsp;Any ideas as to how to go about automating this?&amp;nbsp;Please share. Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Data RandomValueGeneratorStatistics (type=COV);
input _TYPE_ $ _NAME_ $9. variable1 variable2 variable3 variable4;
datalines;
COV variable1 0.999368288 0.009398213 0.075083647 0.453177098
COV variable2 0.009398213 0.000155024 0.000878636 0.006372190
COV variable3 0.075083647 0.000878636 0.008894056 0.043200581
COV variable4 0.453177098 0.006372190 0.043200581 0.999368288
MEAN          3.217123172 42.69388108 3.893316488 8605.147733
;
run; 

Proc Simnorm data=RandomValueGeneratorStatistics outsim=ssim
numreal = 1000
seed = 54321; 
var variable1 variable2 variable3 variable4;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 16:20:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/369981#M275633</guid>
      <dc:creator>PBG</dc:creator>
      <dc:date>2017-06-23T16:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370013#M275634</link>
      <description>&lt;P&gt;Can't you just generate 1000 x 1000 observations in one data set and then process them? &amp;nbsp;Why change the seed?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 16:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370013#M275634</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-06-23T16:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370019#M275635</link>
      <description>&lt;P&gt;Thanks for your response &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;. Yes, that could be done, but I would like to vary the seed to average-out the biases (some of the &lt;EM&gt;psuedo&lt;/EM&gt;randomness) of any single seed. Or is this logic flawed? What role does the seed play in the generation of random values, precisely?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In any case, as I'm entirely new to SAS, this could be a great learning experience for me as it pertains to loops/macros.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370019#M275635</guid>
      <dc:creator>PBG</dc:creator>
      <dc:date>2017-06-23T17:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370029#M275636</link>
      <description>&lt;P&gt;You need to understand random number streams in general, not specifically for SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A seed sets the initial value, so you always get the same 'random' numbers with the same seed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using a seed allows you to replicate the stream to verify your results.&lt;/P&gt;
&lt;P&gt;So changing the seed in a process doesn't quite make sense because you're likely going to either set those manually or not be able to replicate the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370029#M275636</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-23T17:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370031#M275637</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Check out one of Rick Wicklin's several blogs on seeds. &amp;nbsp;&lt;A href="http://blogs.sas.com/content/iml/2017/06/01/choose-seed-random-number.html&amp;nbsp;" target="_blank"&gt;http://blogs.sas.com/content/iml/2017/06/01/choose-seed-random-number.html&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would recommend doing vanilla DATA step programming to get your results rather than using a macro. &amp;nbsp;There are plenty of opportunities for macro loops when they are really needed. &amp;nbsp;I don't know off hand how simnorm generates random numbers. &amp;nbsp;However, if you want to see the strange things that might happen if you pick the wrong seed combinations with the old rannor/ranuni style functions, see the graphs in this page. &amp;nbsp;I love the "bug plot" about half way down.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370031#M275637</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-06-23T17:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370039#M275638</link>
      <description>Thank you both for your help.</description>
      <pubDate>Fri, 23 Jun 2017 17:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370039#M275638</guid>
      <dc:creator>PBG</dc:creator>
      <dc:date>2017-06-23T17:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370040#M275639</link>
      <description>&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001281561.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001281561.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looks like I failed to post the link. &amp;nbsp;This page does answer some of your questions about seeds and what can go wrong when you change seeds.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:34:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370040#M275639</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-06-23T17:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370043#M275640</link>
      <description>&lt;P&gt;If you're doing simulations in SAS this is a good foundational paper to read:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/forum2007/183-2007.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2007/183-2007.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370043#M275640</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-23T17:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Loop/Macro to Iterate Seed of Random Value Generator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370054#M275641</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 17:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-Macro-to-Iterate-Seed-of-Random-Value-Generator/m-p/370054#M275641</guid>
      <dc:creator>PBG</dc:creator>
      <dc:date>2017-06-23T17:58:45Z</dc:date>
    </item>
  </channel>
</rss>

