<?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: random ID in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667584#M23040</link>
    <description>So I created 99999 randomID's and saved it. I am taking the randomID's from the saved ones to assign checkID.&lt;BR /&gt;ID checkID S.NO&lt;BR /&gt;1 34556&lt;BR /&gt;2 45678&lt;BR /&gt;3 67873&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;&lt;BR /&gt;I want to fill these checkID from the randomID continue.&lt;BR /&gt;</description>
    <pubDate>Tue, 07 Jul 2020 21:53:55 GMT</pubDate>
    <dc:creator>Smitha9</dc:creator>
    <dc:date>2020-07-07T21:53:55Z</dc:date>
    <item>
      <title>random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667429#M23028</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a data with random ID assigned( created 5digit random ID for 99999).&lt;/P&gt;&lt;P&gt;ID randomID&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; 34556&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 45678&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp;67873&lt;/P&gt;&lt;P&gt;Now I want to continue assigning the remaining random ID for a different variable. Can I do that?&lt;/P&gt;&lt;P&gt;ID randomID SNO&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;34556&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;45678&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;67873&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;23564&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 67856&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; 73456&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 13:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667429#M23028</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2020-07-07T13:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667431#M23029</link>
      <description>&lt;P&gt;What do you mean by "The remaining random ID"?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 13:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667431#M23029</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-07-07T13:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667433#M23030</link>
      <description>&lt;P&gt;So you need to make sure you do not accidentally use a randomid that is already used?&lt;/P&gt;
&lt;P&gt;See this with a hash object:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id randomid;
datalines;
1    34556
2    45678
3   67873
;

data new;
input sno;
datalines;
1
2
3
;

data want;
set
  have
  new (in=n)
;
if _n_ = 1
then do;
  declare hash rand ();
  rand.definekey('randomid');
  rand.definedone();
end;
if not n
then rc = rand.add();
else do;
  randomid = rand('integer',1,99999);
  do until (rand.check());
    randomid = rand('integer',1,99999);
  end;
  rc = rand.add();
end;
drop rc;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 13:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667433#M23030</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-07T13:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667445#M23032</link>
      <description>&lt;P&gt;If I understand your question correctly:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id randomid sno;
datalines;
1 34556 .
2 45678 .
3 67873 .
. .     1
. .     2
. .     3
;

data want (drop = h r);
   array a {99999} _temporary_ (1:99999);
   retain h 99999;
   set have;
   r = a[rand('integer', 1, h)];
   randomid = coalesce(randomid, r);
   a[randomid] = a[h];
   h +- 1;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Jul 2020 14:11:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667445#M23032</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-07-07T14:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667584#M23040</link>
      <description>So I created 99999 randomID's and saved it. I am taking the randomID's from the saved ones to assign checkID.&lt;BR /&gt;ID checkID S.NO&lt;BR /&gt;1 34556&lt;BR /&gt;2 45678&lt;BR /&gt;3 67873&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;&lt;BR /&gt;I want to fill these checkID from the randomID continue.&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Jul 2020 21:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667584#M23040</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2020-07-07T21:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667586#M23041</link>
      <description>I created Random ID's lets say: 34567,45678,62398,72345,56183,26532&lt;BR /&gt;SO the first 3 I already took it for CheckID. But I want the remaining 3 randomID assigned to S.NO.&lt;BR /&gt;I want like this below:&lt;BR /&gt;ID checkID S.NO&lt;BR /&gt;1 34567&lt;BR /&gt;2 45678&lt;BR /&gt;3 62398&lt;BR /&gt;72345 1&lt;BR /&gt;56183 2&lt;BR /&gt;26532 3</description>
      <pubDate>Tue, 07 Jul 2020 21:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667586#M23041</guid>
      <dc:creator>Smitha9</dc:creator>
      <dc:date>2020-07-07T21:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667623#M23048</link>
      <description>&lt;P&gt;Look at the code&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;posted. Unlike what you describe this code creates the random numbers on-the-fly and then maintains a "blacklist" of numbers already used. This way you don't even have to pre-generate a list of random numbers.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 02:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667623#M23048</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-07-08T02:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: random ID</title>
      <link>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667763#M23056</link>
      <description>&lt;P&gt;You posted essentially the same question two months ago and got many responses:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/unique-random-Patient-ID/m-p/648204" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/unique-random-Patient-ID/m-p/648204&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jul 2020 15:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/random-ID/m-p/667763#M23056</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-07-08T15:38:25Z</dc:date>
    </item>
  </channel>
</rss>

