<?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 Simulate 1000 copies of three variables with variances in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Simulate-1000-copies-of-three-variables-with-variances/m-p/859648#M339616</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Am trying to simulate 1000 copies of three variables x1, x2, and x3 with variances equal to 9. I can choose any mean. How do I do this in sas?&lt;/P&gt;&lt;P&gt;I created this simulation code but I don't know how to include variance =9 or chose any mean. Thanks for your help.&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;do i=1 to 1000;&lt;BR /&gt;y1=rannor(0);&lt;BR /&gt;y2=rannor(0);&lt;BR /&gt;y3=rannor(0);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Feb 2023 20:35:57 GMT</pubDate>
    <dc:creator>CathyVI</dc:creator>
    <dc:date>2023-02-19T20:35:57Z</dc:date>
    <item>
      <title>Simulate 1000 copies of three variables with variances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulate-1000-copies-of-three-variables-with-variances/m-p/859648#M339616</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Am trying to simulate 1000 copies of three variables x1, x2, and x3 with variances equal to 9. I can choose any mean. How do I do this in sas?&lt;/P&gt;&lt;P&gt;I created this simulation code but I don't know how to include variance =9 or chose any mean. Thanks for your help.&lt;/P&gt;&lt;P&gt;data a;&lt;BR /&gt;do i=1 to 1000;&lt;BR /&gt;y1=rannor(0);&lt;BR /&gt;y2=rannor(0);&lt;BR /&gt;y3=rannor(0);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 20:35:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulate-1000-copies-of-three-variables-with-variances/m-p/859648#M339616</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2023-02-19T20:35:57Z</dc:date>
    </item>
    <item>
      <title>Re: Simulate 1000 copies of three variables with variances</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Simulate-1000-copies-of-three-variables-with-variances/m-p/859649#M339617</link>
      <description>&lt;P&gt;You can use the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/p0fpeei0opypg8n1b06qe4r040lv.htm#p0ks84a9b9vnv9n1unenv71z1uuu" target="_self"&gt;RAND function&lt;/A&gt; with the 'normal' option, and then its pretty easy to specify any variance. So in this case, you would specify the lambda parameter to be 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The way you were doing it, using the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/n1xmynm0h9t1k0n1085g9z6uy7yr.htm" target="_self"&gt;RANNOR function&lt;/A&gt;, you are creating a normal random variable which has a standard deviation of 1, and the documentation includes an example of how to get a specific variance. So, its always a good idea to check the documentation. To obtain a variance of 9, you would just multiply the result by the constant value ____ (you fill in the blank).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2023 20:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Simulate-1000-copies-of-three-variables-with-variances/m-p/859649#M339617</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-19T20:55:40Z</dc:date>
    </item>
  </channel>
</rss>

