<?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: Rand function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590527#M169026</link>
    <description>My concern is to control the seed. The sqrt value is a value determined&lt;BR /&gt;from a separate analysis and I only want to add random error and it is not a&lt;BR /&gt;parameter of the normal distribution.&lt;BR /&gt;</description>
    <pubDate>Fri, 20 Sep 2019 18:36:13 GMT</pubDate>
    <dc:creator>jacksonan123</dc:creator>
    <dc:date>2019-09-20T18:36:13Z</dc:date>
    <item>
      <title>Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590436#M168981</link>
      <description>&lt;P&gt;I have been using the rannor function as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eps1=rannor(1)*sqrt(feps1);&lt;/P&gt;&lt;P&gt;eps2=rannor(2)*sqrt(feps2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have looked at examples (e.g., Rand (Normal)),&amp;nbsp; but it is not clear to me how to code my function.&lt;/P&gt;&lt;P&gt;My question is how to properly code my sqrt(feps1) with the rand function for a normal distribution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 15:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590436#M168981</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2019-09-20T15:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590446#M168984</link>
      <description>Have a look at the information here "&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n1xmynm0h9t1k0n1085g9z6uy7yr.htm&amp;amp;locale=en" target="_blank"&gt;https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n1xmynm0h9t1k0n1085g9z6uy7yr.htm&amp;amp;locale=en&lt;/A&gt;" and here "&lt;A href="https://newonlinecourses.science.psu.edu/stat482/node/33/" target="_blank"&gt;https://newonlinecourses.science.psu.edu/stat482/node/33/&lt;/A&gt;". I believe you'll find the examples you request there.</description>
      <pubDate>Fri, 20 Sep 2019 15:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590446#M168984</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2019-09-20T15:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590453#M168987</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44100"&gt;@jacksonan123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have been using the rannor function as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;eps1=rannor(1)*sqrt(feps1);&lt;/P&gt;
&lt;P&gt;eps2=rannor(2)*sqrt(feps2);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have looked at examples (e.g., Rand (Normal)),&amp;nbsp; but it is not clear to me how to code my function.&lt;/P&gt;
&lt;P&gt;My question is how to properly code my sqrt(feps1) with the rand function for a normal distribution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is your concern about controlling the seed of the Rand('Normal') ? If not the equivalent code would be :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;eps1 = rand('Normal') * sqrt(feps1);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or else you example code is misleading as the sqrt(feps1) has no impact on selecting the random value. Or are you trying to use the sqrt value as a parameter of the normal distribution?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 15:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590453#M168987</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-20T15:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590477#M168996</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44100"&gt;@jacksonan123&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unlike the old RANNOR function, the RAND function allows you to specify the (mean and) standard deviation within the function call:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;eps1=rand('normal',0,sqrt(feps1));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Sep 2019 17:03:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590477#M168996</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-09-20T17:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590527#M169026</link>
      <description>My concern is to control the seed. The sqrt value is a value determined&lt;BR /&gt;from a separate analysis and I only want to add random error and it is not a&lt;BR /&gt;parameter of the normal distribution.&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Sep 2019 18:36:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590527#M169026</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2019-09-20T18:36:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590530#M169027</link>
      <description>I received the following reply:&lt;BR /&gt;&lt;BR /&gt;Is your concern about controlling the seed of the Rand('Normal') ? If not&lt;BR /&gt;the equivalent code would be :&lt;BR /&gt;&lt;BR /&gt;eps1 = rand('Normal') * sqrt(feps1);&lt;BR /&gt;&lt;BR /&gt;Which is the same as yours (without the mean), but the issue for me which I&lt;BR /&gt;failed to initially clearly state would be to control the seed as&lt;BR /&gt;indicated in the response.&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Sep 2019 18:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590530#M169027</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2019-09-20T18:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590531#M169028</link>
      <description>Yes that does give an explicit example and also addresses the issue of the&lt;BR /&gt;seed which I failed to mention in the original post.&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Sep 2019 18:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590531#M169028</guid>
      <dc:creator>jacksonan123</dc:creator>
      <dc:date>2019-09-20T18:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590551#M169033</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/44100"&gt;@jacksonan123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I received the following reply:&lt;BR /&gt;&lt;BR /&gt;Is your concern about controlling the seed of the Rand('Normal') ? If not&lt;BR /&gt;the equivalent code would be :&lt;BR /&gt;&lt;BR /&gt;eps1 = rand('Normal') * sqrt(feps1);&lt;BR /&gt;&lt;BR /&gt;Which is the same as yours (without the mean), but the issue for me which I&lt;BR /&gt;failed to initially clearly state would be to control the seed as&lt;BR /&gt;indicated in the response.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you need to repeat the stream of random numbers you would use Call Streaminit(seedvalue) before calling any of the RAND functions. However there is only one stream sequence of random numbers created.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 22:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590551#M169033</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-20T22:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: Rand function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590555#M169036</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;(...) However there is only one stream sequence of random numbers created.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Which is actually the same as with your RANNOR seed values: Specifying different seeds in the same DATA step (like 1 and 2 in your example) is pointless because only the first value will be used (as you can check easily by changing the second seed to the first).&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 22:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Rand-function/m-p/590555#M169036</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-09-20T22:30:29Z</dc:date>
    </item>
  </channel>
</rss>

