HP3000-L Archives

October 1997, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Wirt Atmar <[log in to unmask]>
Reply To:
Date:
Wed, 22 Oct 1997 04:50:05 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (94 lines)
Gavin writes:

> jvaldes writes:
>  >        I'm writing a COBOL program that will select a random sample of
>  > employees.
>
>  Down-sizing or drug testing?
>
>  > Does anyone know of a random number generator function that
>  > will allow me to pick employees using employee id and date of birth?
>
>  I'd just extract them all into a list and use ordinary random numbers to
>  pick elements from the list.
>
>  > The selection should change from year to year.
>
>  Just save this year's list and check next year's selections against it
>  to eliminate duplicates.
>

I originally thought about sending this response to only Jesus and Gavin
because it is QueryCalc-specific, but because I mentioned a week or so that
Rockwell International paid for precisely the statisical sampling
functionality that was put into QueryCalc about eight years ago, I thought
better of it -- and I'll go ahead and bore everyone -- with the usual

<plug alert>.

Step 1: Buy QueryCalc (<--that's the blatant plug portion of this sequence.
However it's also an optional step. All of what follows can be recreated in
virtually any other 3GL language on the HP3000 that has IMAGE database access
capabilities).

Step 2: On a QC spreadsheet, in any cell, type the following query:

    @using employees, store in !a emp-id;sample=0.05;limit=200

Gozanga! (a technical term), you now have your list. The parameters used are
for 5% of the people in the EMPLOYEES dataset will be selected, with a
maximum of 200 people. [As a note, we write a boolean set in QC (in this case
Set A) as "!a". A set is guaranteed of having only unique entries; duplicates
are automatically eliminated.]

You then issue the command:

     /saveset a list97

This command will save Set A as a KSAM dataset, with it automatically being
entered into QueryCalc's dictionary, available for immediate retrieval and
querying.

==================================

One year passes.

==================================

You now type on any set of four cells in the spreadsheet:

     @using employees, store in !a emp-id
     @using list97, store in !b emp-id
     @using sets, !c = !a - !b
     @using employees, store in !d emp-id when
emp-id=!c;limit=200;sample=0.05

     /saveset d list97 append

What we did here, in this new year, was gather up all of the employee id
numbers for all of the employees we currently have on staff and stored them
in Set A. We also re-created last year's set, storing it in Set B. We then
subtracted (using boolean set subtraction), Set B from Set A to create a new
Set C, which is now the set of previously untouched people.

We then created a new Set D by statistically sampling EMPLOYEES dataset only
those employees who haven't yet been bothered. Gozanga deja vu!  We have the
new list of people we want to talk to. We again save this list, appending it
to the previous list we've stored, in preparation for next year. Because
we're only bothering about 5% of the people each year, we could go for 10 to
20 years or so in this manner before we would have to start throwing away the
oldest entries. [As a second technical note, we could have been reusing our
sets instead of creating new sets, with new letters, each time. I did it this
way primarily for clarity.]

Statistical sampling is a more valuable tool, especially for marketing
analyses, than even I gave it credit in the beginning. It was originally put
into QueryCalc as part of a manufacturing assurance program for contracts
Rockwell had with NASA at the time -- but it is one of those behaviors that
has consistently proven its worth over and over again with a wide variety of
customers, most especially manufacturing organizations and credit unions.

</plug>

Wirt Atmar

ATOM RSS1 RSS2