generating random (not consecutive) identification numbers

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

generating random (not consecutive) identification numbers

Debbie Hahs-Vaughn
I have used COMPUTE ID=$CASENUM to generate consecutive identification
numbers.  However how can I generate identification numbers that are not
consecutive but just purely random?  I am trying to avoid having numbers
that are only one digit difference in the ID so that there is less room for
error in what we are trying to do.  Thanks!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

J. R. Carroll
Debbie,

I'll respond with some Python (and maybe pure sytanx ways) a bit later today (assuming I remember!!), but I often direct my students to use Random.org.  This website uses "atmospheric static" to generate seemingly random numbers (it uses static in addition to some choice algorithms which plays on the age-old argument if true-randomization even exists).  As such, there are some options via this website (random.org) which allow you create upwards to millions of cases (or so I think I remember seeing) of consecutive random numbers (aka non repeating numbers).  You can also specific the range so if you a 6 digit random non repeating ID, you can select 100,000-999,999, and it'll give a list of random non-repeating numbers.  Furthermore, I believe there is an export option (if not copy and paste often works well enough for smaller generations).

This is quick, dirty, and I think just as good as using any randomization techniques that SPSS or Python can derive.

In writing this, I can see a process in which you generate the $casenum, as you've done in the past, and use a random algorithm in SPSS (pure syntax) to select from the available cases you already generated (thus picking from the set of numbers at random, and reordering them based on their ordinal selection: aka the first case selected might be 642,324 which goes at the top of the column).  Interesting thought!  I'll play around with it tonight/tomorrow (hopefully!) and get back to you if one of the listers doesn't respond with a more cogent response.

Check out random.org though (specifically http://www.random.org/sequences/), I don't see why this couldn't work in your situation as a quick solution (specifics of your situation notwithstanding).

hth,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204


On Mon, Sep 27, 2010 at 11:04 AM, Debbie Hahs-Vaughn <[hidden email]> wrote:
I have used COMPUTE ID=$CASENUM to generate consecutive identification
numbers.  However how can I generate identification numbers that are not
consecutive but just purely random?  I am trying to avoid having numbers
that are only one digit difference in the ID so that there is less room for
error in what we are trying to do.  Thanks!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

Rick Oliver-3
If the sort order of the cases doesn't matter:

compute id=$casenum.
compute randvar=rv.uniform(1,100).
sort cases by randvar.
delete variables randvar.

If the sort order does matter:

compute casenum=$casenum.
compute randvar=rv.uniform(1,100).
sort cases by randvar.
compute id=$casenum.
sort cases by casenum.
delete variables casenum randvar.


From: Justin Carroll <[hidden email]>
To: [hidden email]
Date: 09/27/2010 01:20 PM
Subject: Re: generating random (not consecutive) identification numbers
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Debbie,

I'll respond with some Python (and maybe pure sytanx ways) a bit later today (assuming I remember!!), but I often direct my students to use Random.org.  This website uses "atmospheric static" to generate seemingly random numbers (it uses static in addition to some choice algorithms which plays on the age-old argument if true-randomization even exists).  As such, there are some options via this website (
random.org) which allow you create upwards to millions of cases (or so I think I remember seeing) of consecutive random numbers (aka non repeating numbers).  You can also specific the range so if you a 6 digit random non repeating ID, you can select 100,000-999,999, and it'll give a list of random non-repeating numbers.  Furthermore, I believe there is an export option (if not copy and paste often works well enough for smaller generations).

This is quick, dirty, and I think just as good as using any randomization techniques that SPSS or Python can derive.

In writing this, I can see a process in which you generate the $casenum, as you've done in the past, and use a random algorithm in SPSS (pure syntax) to select from the available cases you already generated (thus picking from the set of numbers at random, and reordering them based on their ordinal selection: aka the first case selected might be 642,324 which goes at the top of the column).  Interesting thought!  I'll play around with it tonight/tomorrow (hopefully!) and get back to you if one of the listers doesn't respond with a more cogent response.

Check out
random.org though (specifically http://www.random.org/sequences/), I don't see why this couldn't work in your situation as a quick solution (specifics of your situation notwithstanding).

hth,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email: 
jrc.csus@...   -or-   jrcarroll@...
Phone:  (916) 628-4204


On Mon, Sep 27, 2010 at 11:04 AM, Debbie Hahs-Vaughn <dhahs@...> wrote:
I have used COMPUTE ID=$CASENUM to generate consecutive identification
numbers.  However how can I generate identification numbers that are not
consecutive but just purely random?  I am trying to avoid having numbers
that are only one digit difference in the ID so that there is less room for
error in what we are trying to do.  Thanks!

=====================
To manage your subscription to SPSSX-L, send a message to

LISTSERV@... (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

J. R. Carroll
In reply to this post by J. R. Carroll
As a brief followup as well:

1.  I've never had any problems with random.org (for the last 7 years I have used it), but I always harbor a sense of cynicism regarding allowing someone else to do my work.  As such, I would recommend running frequencies /JUST/ to double check to make sure there are no duplicate cases (again, I've NEVER had a problem, but I always make sure).  Of course, frequencies may not be appropriate and/or a good detection technique if you have millions+ of cases; if that is the case there are a number of alternatives I can think of on checking to make sure no duplicate cases exists (all Python driven, however).

2.  I just checked on Random.org, and see that you can create to 1 billion cases (2 billion if you use negative numbers, but then you have repeating numbers with only the sign being different).  Additionally, I did not see an "export" feature on the sequence generator, so you'll have to copy/paste and/or save the html and parse the data out (if you wanted to use a 3rd party language to parse the data I would recommend "select all" and copy/paste the formatted text into a flat file (.txt or w/e works best for you), this avoids having to 'fish out' all the HTML that is sure to be laden throughout.  

Glad to hear this solution, albeit not SPSS driven, was amicable to your situation; I'll withhold from the followup with Python/SPSS solutions then, unless otherwise requested, seeing as the problem was solved!

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204


On Mon, Sep 27, 2010 at 11:47 AM, Debbie Hahs-Vaughn <[hidden email]> wrote:
This sounds perfect.  Quick and easy works for me!!  Thanks for the quick response and helpful information!

~~~~~~~~~~~~~~~~~~~~
Debbie Hahs-Vaughn, Ph.D.
Associate Professor, Educational Research
College of Education
University of Central Florida
4000 Central Florida Blvd.
222M Education Complex
PO Box 161250
Orlando, FL 32816-1250

Phone:  407-823-1762
Fax:  407-823-4880
Email:  [hidden email]
My webpage:  http://pegasus.cc.ucf.edu/~dhahszva/

>>> Justin Carroll <[hidden email]> 9/27/2010 2:19 PM >>>
Debbie,

I'll respond with some Python (and maybe pure sytanx ways) a bit later today
(assuming I remember!!), but I often direct my students to use Random.org.
This website uses "atmospheric static" to generate seemingly random numbers
(it uses static in addition to some choice algorithms which plays on the
age-old argument if true-randomization even exists).  As such, there are
some options via this website (random.org) which allow you create upwards to
millions of cases (or so I think I remember seeing) of consecutive random
numbers (aka non repeating numbers).  You can also specific the range so if
you a 6 digit random non repeating ID, you can select 100,000-999,999, and
it'll give a list of random non-repeating numbers.  Furthermore, I believe
there is an export option (if not copy and paste often works well enough for
smaller generations).

This is quick, dirty, and I think just as good as using any randomization
techniques that SPSS or Python can derive.

In writing this, I can see a process in which you generate the $casenum, as
you've done in the past, and use a random algorithm in SPSS (pure syntax) to
select from the available cases you already generated (thus picking from the
set of numbers at random, and reordering them based on their ordinal
selection: aka the first case selected might be 642,324 which goes at the
top of the column).  Interesting thought!  I'll play around with it
tonight/tomorrow (hopefully!) and get back to you if one of the listers
doesn't respond with a more cogent response.

Check out random.org though (specifically http://www.random.org/sequences/),
I don't see why this couldn't work in your situation as a quick solution
(specifics of your situation notwithstanding).

hth,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204


On Mon, Sep 27, 2010 at 11:04 AM, Debbie Hahs-Vaughn <[hidden email]>wrote:

> I have used COMPUTE ID=$CASENUM to generate consecutive identification
> numbers.  However how can I generate identification numbers that are not
> consecutive but just purely random?  I am trying to avoid having numbers
> that are only one digit difference in the ID so that there is less room for
> error in what we are trying to do.  Thanks!
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>


Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

Bruce Weaver
Administrator
In reply to this post by Debbie Hahs-Vaughn
Debbie Hahs-Vaughn wrote
I have used COMPUTE ID=$CASENUM to generate consecutive identification
numbers.  However how can I generate identification numbers that are not
consecutive but just purely random?  I am trying to avoid having numbers
that are only one digit difference in the ID so that there is less room for
error in what we are trying to do.  Thanks!
Instead of $casenum, use one of the random variable functions, such as RV.UNIFORM.  From the Help:

RV.UNIFORM. RV.UNIFORM(min, max). Numeric. Returns a random value from a uniform distribution with specified minimum and maximum. See also the UNIFORM function.

If you want to obtain the same IDs every time you run the syntax, set the value of the seed first (via the SET command).  Here's the description of the seed from the Help:

"Initialization value for MC random number generator. The value must be a positive integer that is less than 2,000,000,000 or the keyword RANDOM, which randomly sets the initialization value. The default is 2,000,000."

And finally, assuming you have one row  per ID, you'll want to follow up with a check for duplicate IDs.  It's not very likely, but could happen.  

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

Albert-Jan Roskam
In reply to this post by J. R. Carroll
Hello,

Why make completely random numbers? For bank numbers and ssn, often a mechanism is used to minimize the risk of typos. That is, typos often yield a non-existent code. Below is a little program to generate numbers that are "modulus 11 proof" http://docs.hp.com/en/32209-90024/apds02.html.  There are various ways to do this ( I used a 'control digit' method). Check the code because I just cobbled it together.
 
Cheers!!
Albert-Jan

import os

def isValidSsn(ssnNum, nDigits = 9):
    ssn = str(ssnNum).zfill(nDigits)
    sigma = 0
    for n, digit in enumerate(ssn[:-1]):
        sigma += (len(ssn) - n) * int(digit)
        check = int(ssn[-1])
    if sigma % 11 == check:
        return True
    else:
        return False

def makeSsns(outfile = "c:/temp/ssn.txt", n = 20, offset = 10000):
    with open(outfile, "wb") as f:
        nSsn = 0
        ssn = 0 + offset
        while True:
            ssn += 1
            sigma = 0
            if isValidSsn(ssn):
                nSsn += 1
                f.write(str(ssn).zfill(9) + os.linesep)
            if nSsn == n:
                break

makeSsns(n = 20)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



From: Justin Carroll <[hidden email]>
To: [hidden email]
Sent: Mon, September 27, 2010 8:19:33 PM
Subject: Re: [SPSSX-L] generating random (not consecutive) identification numbers

Debbie,

I'll respond with some Python (and maybe pure sytanx ways) a bit later today (assuming I remember!!), but I often direct my students to use Random.org.  This website uses "atmospheric static" to generate seemingly random numbers (it uses static in addition to some choice algorithms which plays on the age-old argument if true-randomization even exists).  As such, there are some options via this website (random.org) which allow you create upwards to millions of cases (or so I think I remember seeing) of consecutive random numbers (aka non repeating numbers).  You can also specific the range so if you a 6 digit random non repeating ID, you can select 100,000-999,999, and it'll give a list of random non-repeating numbers.  Furthermore, I believe there is an export option (if not copy and paste often works well enough for smaller generations).

This is quick, dirty, and I think just as good as using any randomization techniques that SPSS or Python can derive.

In writing this, I can see a process in which you generate the $casenum, as you've done in the past, and use a random algorithm in SPSS (pure syntax) to select from the available cases you already generated (thus picking from the set of numbers at random, and reordering them based on their ordinal selection: aka the first case selected might be 642,324 which goes at the top of the column).  Interesting thought!  I'll play around with it tonight/tomorrow (hopefully!) and get back to you if one of the listers doesn't respond with a more cogent response.

Check out random.org though (specifically http://www.random.org/sequences/), I don't see why this couldn't work in your situation as a quick solution (specifics of your situation notwithstanding).

hth,

J. R. Carroll
Grad. Student in Pre-Doc Psychology at CSUS
Research Assistant for Just About Everyone.
Email:  [hidden email]   -or-   [hidden email]
Phone:  (916) 628-4204


On Mon, Sep 27, 2010 at 11:04 AM, Debbie Hahs-Vaughn <[hidden email]> wrote:
I have used COMPUTE ID=$CASENUM to generate consecutive identification
numbers.  However how can I generate identification numbers that are not
consecutive but just purely random?  I am trying to avoid having numbers
that are only one digit difference in the ID so that there is less room for
error in what we are trying to do.  Thanks!

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

Rick Oliver-3
In reply to this post by Bruce Weaver
Using this method, the unique IDs will contain decimals. If you truncate or round the values, they may no longer be unique, unless the specified range of values is considerably larger than the number of cases.


From: Bruce Weaver <[hidden email]>
To: [hidden email]
Date: 09/27/2010 02:34 PM
Subject: Re: generating random (not consecutive) identification numbers
Sent by: "SPSSX(r) Discussion" <[hidden email]>





Debbie Hahs-Vaughn wrote:
>
> I have used COMPUTE ID=$CASENUM to generate consecutive identification
> numbers.  However how can I generate identification numbers that are not
> consecutive but just purely random?  I am trying to avoid having numbers
> that are only one digit difference in the ID so that there is less room
> for
> error in what we are trying to do.  Thanks!
>
>

Instead of $casenum, use one of the random variable functions, such as
RV.UNIFORM.  From the Help:

RV.UNIFORM. RV.UNIFORM(min, max). Numeric. Returns a random value from a
uniform distribution with specified minimum and maximum. See also the
UNIFORM function.

If you want to obtain the same IDs every time you run the syntax, set the
value of the seed first (via the SET command).  Here's the description of
the seed from the Help:

"Initialization value for MC random number generator. The value must be a
positive integer that is less than 2,000,000,000 or the keyword RANDOM,
which randomly sets the initialization value. The default is 2,000,000."

And finally, assuming you have one row  per ID, you'll want to follow up
with a check for duplicate IDs.  It's not very likely, but could happen.



-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/generating-random-not-consecutive-identification-numbers-tp2855693p2855817.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

Bruce Weaver
Administrator
Agreed.  What I was thinking, but didn't say explicitly was that one would need a large range of values; and that to get rid of the decimals, one could then multiply by some large multiple of 10 before truncating or rounding.  Something like this, for example:

new file.
dataset close all.

* Generate a file with lots of cases.

INPUT PROGRAM.
LOOP case=1 TO 10000.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.

* Compute a random ID number with a large range, and truncate.
compute id = trunc(rv.uniform(1, 10**10)).
exe.

* Use the NU function in AGGREGATE to obtain the
* number of cases for each unique ID number.

AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=id
  /n_ID=Nu.

freq n_ID.

* If there are no duplicate IDs, the frequency
* table should show only a value of 1 with the
* frequency count being the number of cases in
* the file.


I've run this a few times, and have not yet to see any duplicate IDs.

Cheers,
Bruce



Rick Oliver wrote
Using this method, the unique IDs will contain decimals. If you truncate
or round the values, they may no longer be unique, unless the specified
range of values is considerably larger than the number of cases.



From:
Bruce Weaver <bruce.weaver@hotmail.com>
To:
SPSSX-L@LISTSERV.UGA.EDU
Date:
09/27/2010 02:34 PM
Subject:
Re: generating random (not consecutive) identification numbers
Sent by:
"SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>



Debbie Hahs-Vaughn wrote:
>
> I have used COMPUTE ID=$CASENUM to generate consecutive identification
> numbers.  However how can I generate identification numbers that are not
> consecutive but just purely random?  I am trying to avoid having numbers
> that are only one digit difference in the ID so that there is less room
> for
> error in what we are trying to do.  Thanks!
>
>

Instead of $casenum, use one of the random variable functions, such as
RV.UNIFORM.  From the Help:

RV.UNIFORM. RV.UNIFORM(min, max). Numeric. Returns a random value from a
uniform distribution with specified minimum and maximum. See also the
UNIFORM function.

If you want to obtain the same IDs every time you run the syntax, set the
value of the seed first (via the SET command).  Here's the description of
the seed from the Help:

"Initialization value for MC random number generator. The value must be a
positive integer that is less than 2,000,000,000 or the keyword RANDOM,
which randomly sets the initialization value. The default is 2,000,000."

And finally, assuming you have one row  per ID, you'll want to follow up
with a check for duplicate IDs.  It's not very likely, but could happen.



-----
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/generating-random-not-consecutive-identification-numbers-tp2855693p2855817.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: generating random (not consecutive) identification numbers

Jon K Peck
Another approach would be to use the SPSSINC ANON extension command from Developer Central to randomize the id's.  It provides several different methods, will ensure that the values are 1-1 with the inputs, and can save the randomization so that new cases can be added or the scheme reapplied.  You can read the details in the download from www.spss.com/devcentral.&nbsp; The package includes a dialog box as well as standard SPSS Statistics syntax.

HTH,
Jon Peck
(from NY)


-----"SPSSX(r) Discussion" [hidden email] wrote: -----

To: [hidden email]
From: Bruce Weaver [hidden email]
Sent by: "SPSSX(r) Discussion" [hidden email]
Date: 09/27/2010 04:41PM
Subject: Re: [SPSSX-L] generating random (not consecutive) identification numbers

Agreed.  What I was thinking, but didn't say explicitly was that one would
need a large range of values; and that to get rid of the decimals, one could
then multiply by some large multiple of 10 before truncating or rounding.
Something like this, for example:

new file.
dataset close all.

* Generate a file with lots of cases.

INPUT PROGRAM.
LOOP case=1 TO 10000.
END CASE.
END LOOP.
END FILE.
END INPUT PROGRAM.
EXECUTE.

* Compute a random ID number with a large range, and truncate.
compute id = trunc(rv.uniform(1, 10**10)).
exe.

* Use the NU function in AGGREGATE to obtain the
* number of cases for each unique ID number.

AGGREGATE
  /OUTFILE=* MODE=ADDVARIABLES
  /BREAK=id
  /n_ID=Nu.

freq n_ID.

* If there are no duplicate IDs, the frequency
* table should show only a value of 1 with the
* frequency count being the number of cases in
* the file.


I've run this a few times, and have not yet to see any duplicate IDs.

Cheers,
Bruce




Rick Oliver wrote:

>
> Using this method, the unique IDs will contain decimals. If you truncate
> or round the values, they may no longer be unique, unless the specified
> range of values is considerably larger than the number of cases.
>
>
>
> From:
> Bruce Weaver [hidden email]
> To:
> [hidden email]
> Date:
> 09/27/2010 02:34 PM
> Subject:
> Re: generating random (not consecutive) identification numbers
> Sent by:
> "SPSSX(r) Discussion" [hidden email]
>
>
>
> Debbie Hahs-Vaughn wrote:
>>
>> I have used COMPUTE ID=$CASENUM to generate consecutive identification
>> numbers.  However how can I generate identification numbers that are not
>> consecutive but just purely random?  I am trying to avoid having numbers
>> that are only one digit difference in the ID so that there is less room
>> for
>> error in what we are trying to do.  Thanks!
>>
>>
>
> Instead of $casenum, use one of the random variable functions, such as
> RV.UNIFORM.  From the Help:
>
> RV.UNIFORM. RV.UNIFORM(min, max). Numeric. Returns a random value from a
> uniform distribution with specified minimum and maximum. See also the
> UNIFORM function.
>
> If you want to obtain the same IDs every time you run the syntax, set the
> value of the seed first (via the SET command).  Here's the description of
> the seed from the Help:
>
> "Initialization value for MC random number generator. The value must be a
> positive integer that is less than 2,000,000,000 or the keyword RANDOM,
> which randomly sets the initialization value. The default is 2,000,000."
>
> And finally, assuming you have one row  per ID, you'll want to follow up
> with a check for duplicate IDs.  It's not very likely, but could happen.
>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/generating-random-not-consecutive-identification-numbers-tp2855693p2855817.html
>
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>
>


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/generating-random-not-consecutive-identification-numbers-tp2855693p2855887.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

====================To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD