<?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 Random Numbers with specific format in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556549#M155025</link>
    <description>&lt;P&gt;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 want(drop=i);
   length num $20;
   do i=1 to 25;
      num=cats("AB", rand('integer', 100, 10000));
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 May 2019 20:01:30 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2019-05-06T20:01:30Z</dc:date>
    <item>
      <title>Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556546#M155023</link>
      <description>&lt;P&gt;Hi, I would like to create a list of 25 randomly generated numbers that start with the two letters "AB----" ex: AB14587, AB65899, AB36525, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked into the RAND function, but can't seem to figure out how I would incorporate the "AB-" in there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 19:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556546#M155023</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-05-06T19:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556548#M155024</link>
      <description>&lt;P&gt;You could combine the output from this link with what you already have for the numeric portion:&amp;nbsp;&lt;A href="http://support.sas.com/kb/51/386.html" target="_blank"&gt;http://support.sas.com/kb/51/386.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This would be combining 2 random elements: the text and the numbers.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 19:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556548#M155024</guid>
      <dc:creator>noling</dc:creator>
      <dc:date>2019-05-06T19:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556549#M155025</link>
      <description>&lt;P&gt;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 want(drop=i);
   length num $20;
   do i=1 to 25;
      num=cats("AB", rand('integer', 100, 10000));
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 20:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556549#M155025</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-06T20:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556558#M155028</link>
      <description>&lt;P&gt;Modifying&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;solution very slightly to use Z5 format so that you always have a string of the same length.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=i);
   length num $20;
   do i=1 to 25;
      num=cats("AB", put(rand('integer', 1, 10000), z5.));
      output;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 20:16:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556558#M155028</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-06T20:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556560#M155029</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi, I would like to create a list of 25 randomly generated numbers that start with the two letters "AB----" ex: AB14587, AB65899, AB36525, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked into the RAND function, but can't seem to figure out how I would incorporate the "AB-" in there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help would be much appreciated!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Being a bit pedantic but unless AB are HEX digits then you are NOT generating random "numbers".&lt;/P&gt;
&lt;P&gt;If you cast the question as "I would like to create a string value that starts with AB- followed by a random number" you might even have figured it out yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a specific range in the number of digits the number part must possess?&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 20:18:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556560#M155029</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-06T20:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556562#M155030</link>
      <description>What about duplicates? Are duplicates allowed?</description>
      <pubDate>Mon, 06 May 2019 20:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556562#M155030</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-06T20:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556570#M155034</link>
      <description>&lt;P&gt;Duplicates would not be allowed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried it using the do loop and it worked the way I needed it to!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 20:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556570#M155034</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2019-05-06T20:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generating Random Numbers with specific format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556578#M155038</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Duplicates would not be allowed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried it using the do loop and it worked the way I needed it to!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;My solution may generate duplicates.&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 21:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generating-Random-Numbers-with-specific-format/m-p/556578#M155038</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-06T21:31:29Z</dc:date>
    </item>
  </channel>
</rss>

