<?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: Generating a random output from an array in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570614#M11989</link>
    <description>Do they have teh same probability of occurring? If so, see &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;'s solution. If not, you can modify it with the TABLE option on the RAND() function.</description>
    <pubDate>Tue, 02 Jul 2019 15:46:30 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-07-02T15:46:30Z</dc:date>
    <item>
      <title>Generating a random output from an array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570473#M11960</link>
      <description>&lt;P&gt;Hi there,&lt;BR /&gt;&lt;BR /&gt;I would like to generate a random output from a set of list in an array.&lt;BR /&gt;&lt;BR /&gt;For example, let x be an array in the data step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x = {apple, orange, pear}.&lt;BR /&gt;&lt;BR /&gt;I would like to create a new variable to generate a random output from the list above.&lt;BR /&gt;&lt;BR /&gt;How do I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tan&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570473#M11960</guid>
      <dc:creator>TanV</dc:creator>
      <dc:date>2019-07-02T10:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random output from an array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570474#M11961</link>
      <description>&lt;P&gt;Welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   array MyArray{3} $ _temporary_ ("Apple", "Orange", "Pear");
   RandomFruit=MyArray[rand('integer', 1, dim(MyArray))];
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:25:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570474#M11961</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-02T10:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a random output from an array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570614#M11989</link>
      <description>Do they have teh same probability of occurring? If so, see &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;'s solution. If not, you can modify it with the TABLE option on the RAND() function.</description>
      <pubDate>Tue, 02 Jul 2019 15:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Generating-a-random-output-from-an-array/m-p/570614#M11989</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-02T15:46:30Z</dc:date>
    </item>
  </channel>
</rss>

