<?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 How to create a random sample with seeds of time + minute + second ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553499#M153929</link>
    <description>&lt;P&gt;Hi I need to create 1000 samples for simulation study. Does any one know how to create a random sample with seeds of time + minute + second ? Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 24 Apr 2019 02:34:13 GMT</pubDate>
    <dc:creator>HappySASUE</dc:creator>
    <dc:date>2019-04-24T02:34:13Z</dc:date>
    <item>
      <title>How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553499#M153929</link>
      <description>&lt;P&gt;Hi I need to create 1000 samples for simulation study. Does any one know how to create a random sample with seeds of time + minute + second ? Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 02:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553499#M153929</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-04-24T02:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553503#M153932</link>
      <description>&lt;P&gt;Can you explain further what you mean by "with seeds of time + minute + second"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want the pseudo random number seed to be based on the computer clock you can 1) omit to set a seed or 2) set the seed to a negative number.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 02:45:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553503#M153932</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-24T02:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553509#M153936</link>
      <description>&lt;P&gt;Sure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to run 1000 times, however with the current code, they all have the same seed =&amp;nbsp;12345.&amp;nbsp; I want to create a macro variable which change every time I pull the sample.&amp;nbsp; One idea is to set the seed macro variable as the time we create the samples.&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example for the first iteration: if time is 10am 1 minute 1 second&amp;nbsp; &amp;nbsp;then %let seed = 100101; second iteration seed become&amp;nbsp; &amp;nbsp;100111 if each simulation takes 10 seconds.&amp;nbsp; I remember SAS has a function of current time...system....I forget. It create a macro variable of the current time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro uniform(datain =, dataout =, size = );&lt;BR /&gt;/*pulling a random sample from original data*/&lt;BR /&gt;data &amp;amp;dataout. (drop=obsleft sampsize);&lt;BR /&gt;sampsize= &amp;amp;size.;&lt;BR /&gt;obsleft=totobs;&lt;BR /&gt;do while(sampsize&amp;gt;0);&lt;BR /&gt;pickit+1;&lt;BR /&gt;if ranuni(12345)&amp;lt;sampsize/obsleft then do;&lt;BR /&gt;set &amp;amp;datain. point=pickit&lt;BR /&gt;nobs=totobs;&lt;BR /&gt;output;&lt;BR /&gt;sampsize=sampsize-1;&lt;BR /&gt;end;&lt;BR /&gt;obsleft=obsleft-1;&lt;BR /&gt;end;&lt;BR /&gt;stop;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%mend uniform;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553509#M153936</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-04-24T03:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553511#M153937</link>
      <description>&lt;P&gt;If datain is always the same, you should use &lt;STRONG&gt;proc surveyselect&lt;/STRONG&gt; with option reps=1000.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get a different seed on every iteration, just omit setting the seed yourself. SAS will use the system clock by default.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:13:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553511#M153937</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-24T03:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553512#M153938</link>
      <description>&lt;P&gt;I see.. How about "call streaminit(321)"? Does it use seed 321 for 1000 iterations?&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:20:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553512#M153938</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-04-24T03:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553515#M153939</link>
      <description>&lt;P&gt;That would reset the seed to 321 at every execution of the datastep.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553515#M153939</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-24T03:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a random sample with seeds of time + minute + second ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553516#M153940</link>
      <description>&lt;P&gt;Understand. Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-random-sample-with-seeds-of-time-minute-second/m-p/553516#M153940</guid>
      <dc:creator>HappySASUE</dc:creator>
      <dc:date>2019-04-24T03:32:18Z</dc:date>
    </item>
  </channel>
</rss>

