<?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: Issue with Random Number Generation in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297289#M1076</link>
    <description>&lt;P&gt;Yeah, I don't think so either. Hopefully this helps provide you with some more direction:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;X1 ~ N(1, 4) -&amp;gt; X is Normally distributed with a mean of 1 and standard deviation of 4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RANNOR (Seed)&lt;/P&gt;
&lt;BLOCKQUOTE&gt;The RANNOR function returns a variate that is generated from a normal distribution with &lt;U&gt;&lt;STRONG&gt;mean 0 and variance 1&lt;/STRONG&gt;&lt;/U&gt;. The Box-Muller transformation of RANUNI uniform variates is used.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading further into the documentation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="p0q9g2g06bvnhnn1wkq0hnl2v5x9" class="xis-paragraph"&gt;&lt;U&gt;&lt;STRONG&gt;A normal variate X with mean MU and variance S2&lt;/STRONG&gt;&lt;/U&gt; can be generated with this code:&lt;/DIV&gt;
&lt;DIV id="p04qin1ulg0wuin1bnlxts74l7jn" class="xis-codeBlock"&gt;
&lt;PRE class="xis-code"&gt;x=MU+sqrt(S2)*rannor(seed);&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your order is also incorrect. You need to create the random variables X1/X2/Noise &lt;U&gt;before&lt;/U&gt; you apply the formula.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Sep 2016 01:18:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-09-09T01:18:51Z</dc:date>
    <item>
      <title>Issue with Random Number Generation</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297288#M1075</link>
      <description>&lt;P&gt;I am trying to solve this issue and I am very new to sas. &amp;nbsp;Can someone please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simulate 200 observations from the following linear model: Y = alpha + beta1 * X1 + beta2 * X2 + noise&lt;/P&gt;&lt;P&gt;where&lt;/P&gt;&lt;P&gt;• alpha=1, beta1=2, beta2=-1.5&lt;/P&gt;&lt;P&gt;• X1 ~ N(1, 4), X2 ~ N(3,1), noise ~ N(0,1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this so far but do not think its right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA ONE;&lt;BR /&gt;alpha = 1;&lt;BR /&gt;beta1 = 2;&lt;BR /&gt;beta2 = -1.5;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;DATA CALC;&lt;BR /&gt;SET ONE;&lt;BR /&gt;DO i = 1 to 200;&lt;BR /&gt;Y=alpha+beta1*X1+beta2*X2+Noise;&lt;BR /&gt;X1=Rannor(1);&lt;BR /&gt;X2=rannor(3);&lt;BR /&gt;Noise=ranuni(0);&lt;BR /&gt;OUTPUT;&lt;BR /&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;PROC PRINT DATA=CALC;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 00:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297288#M1075</guid>
      <dc:creator>buckeyebmr</dc:creator>
      <dc:date>2016-09-09T00:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Random Number Generation</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297289#M1076</link>
      <description>&lt;P&gt;Yeah, I don't think so either. Hopefully this helps provide you with some more direction:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;X1 ~ N(1, 4) -&amp;gt; X is Normally distributed with a mean of 1 and standard deviation of 4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;RANNOR (Seed)&lt;/P&gt;
&lt;BLOCKQUOTE&gt;The RANNOR function returns a variate that is generated from a normal distribution with &lt;U&gt;&lt;STRONG&gt;mean 0 and variance 1&lt;/STRONG&gt;&lt;/U&gt;. The Box-Muller transformation of RANUNI uniform variates is used.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading further into the documentation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="p0q9g2g06bvnhnn1wkq0hnl2v5x9" class="xis-paragraph"&gt;&lt;U&gt;&lt;STRONG&gt;A normal variate X with mean MU and variance S2&lt;/STRONG&gt;&lt;/U&gt; can be generated with this code:&lt;/DIV&gt;
&lt;DIV id="p04qin1ulg0wuin1bnlxts74l7jn" class="xis-codeBlock"&gt;
&lt;PRE class="xis-code"&gt;x=MU+sqrt(S2)*rannor(seed);&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your order is also incorrect. You need to create the random variables X1/X2/Noise &lt;U&gt;before&lt;/U&gt; you apply the formula.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 01:18:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297289#M1076</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-09T01:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Random Number Generation</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297304#M1077</link>
      <description>&lt;PRE&gt;
It is X~N(mu,sigma^2) ,right ?







DATA CALC;
alpha = 1;
beta1 = 2;
beta2 = -1.5;
call streaminit(1234);


DO i = 1 to 200;
X1=rand('normal',1,2);
X2=rand('normal',3,1);
Noise=rand('normal');
Y=alpha+beta1*X1+beta2*X2+Noise;

OUTPUT;
END;
RUN;

PROC PRINT DATA=CALC;
RUN;

&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Sep 2016 05:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Issue-with-Random-Number-Generation/m-p/297304#M1077</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-09T05:07:32Z</dc:date>
    </item>
  </channel>
</rss>

