<?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: How to simulate a Bernouilli variable in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-simulate-a-Bernouilli-variable/m-p/415670#M3832</link>
    <description>&lt;P&gt;The &lt;A href="http://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0fpeei0opypg8n1b06qe4r040lv.htm&amp;amp;locale=en" target="_self"&gt;RAND function&lt;/A&gt; (DATA step) and the RANDGEN function (SAS/IML) supports about 25 distributions, including the Bernoulli distribution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you included looks like you want the DATA step solution, even though you posted to the SAS/IML forum (??): The following DATA step&amp;nbsp;generates 10 random Bernoulli variates, each which has a 0.3 probability of appearing:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Bern;
call streaminit(7453293);
do i = 1 to 15;
   x = rand("Bernoulli", 0.3);
   output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By the way, there are &lt;A href="https://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html" target="_self"&gt;many reasons&amp;nbsp;why you should transition to use RAND instead of the older RANUNI and RANNOR functions&lt;/A&gt;, which are &lt;A href="http://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p1fkiqt9ygapyxn1pd1w8manlpub.htm&amp;amp;locale=en" target="_self"&gt;deprecated&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2017 21:26:08 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2017-11-22T21:26:08Z</dc:date>
    <item>
      <title>How to simulate a Bernouilli variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-simulate-a-Bernouilli-variable/m-p/415614#M3831</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering about simulate a bernouilli variable with parameter h.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know how to simulate a normale variable for example :&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;retain&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; seed &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;7453293&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rannor(seed,epsi);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;X_t= epsi;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;But I don't know how to simulate a bernouilli.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;Thank you for your help&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 19:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-simulate-a-Bernouilli-variable/m-p/415614#M3831</guid>
      <dc:creator>madix</dc:creator>
      <dc:date>2017-11-22T19:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to simulate a Bernouilli variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-simulate-a-Bernouilli-variable/m-p/415670#M3832</link>
      <description>&lt;P&gt;The &lt;A href="http://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p0fpeei0opypg8n1b06qe4r040lv.htm&amp;amp;locale=en" target="_self"&gt;RAND function&lt;/A&gt; (DATA step) and the RANDGEN function (SAS/IML) supports about 25 distributions, including the Bernoulli distribution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code you included looks like you want the DATA step solution, even though you posted to the SAS/IML forum (??): The following DATA step&amp;nbsp;generates 10 random Bernoulli variates, each which has a 0.3 probability of appearing:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Bern;
call streaminit(7453293);
do i = 1 to 15;
   x = rand("Bernoulli", 0.3);
   output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;By the way, there are &lt;A href="https://blogs.sas.com/content/iml/2013/07/10/stop-using-ranuni.html" target="_self"&gt;many reasons&amp;nbsp;why you should transition to use RAND instead of the older RANUNI and RANNOR functions&lt;/A&gt;, which are &lt;A href="http://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.2&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=p1fkiqt9ygapyxn1pd1w8manlpub.htm&amp;amp;locale=en" target="_self"&gt;deprecated&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 21:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-simulate-a-Bernouilli-variable/m-p/415670#M3832</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-11-22T21:26:08Z</dc:date>
    </item>
  </channel>
</rss>

