LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 2 Feb 2006 23:12:31 -0500
Reply-To:     Richard Ristow <wrristow@mindspring.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <wrristow@mindspring.com>
Subject:      Re: Random ditribution
Comments: To: Ebby Madera <Ebby.Madera@EQAO.com>
In-Reply-To:  <5263A45F57547546AB4F295AA26A38D321C37C@eqaoexc01.eqao.com>
Content-Type: text/plain; charset=us-ascii; format=flowed;
              x-avg-checked=avg-ok-6B7C419A

At 05:04 PM 2/2/2006, Ebby Madera asked (off-list):

>Thank you very much for the explaination and syntax. I am in the >process of applying it.

I'd written,

>>Here's a second inefficiency, and it might matter with a long enough >>list of schools (though I'll guess that 4,000 is not a long enough >>list.) >> >>Logic below has two full-file sorts, and not easy ones - records are >>moved far from their initial positions, and back again. >> >>SORT CASES BY CURRNUMB. >>MATCH FILES >> /FILE=* >> /TABLE=CURRICULA >> /BY CURRNUMB. >>SORT CASES BY SCHLNUMB CURRNUMB.

and she asked, > I will appreciate if you sent me the look-up-table logic.

Here goes. For the process of assigning curricula randomly to schools, see my posting in this thread, Wed, 1 Feb 2006 16:13:27 -0500.

As drawbacks, this method leaves one initial useless record in the output, plus the variables CURR01 TO CURR16.

The 'LIST' commands are included for illustration, of course. In a large file, they'd slow processing noticeably; each causes a full pass through the data, as EXECUTE does.

* The list of curricula and their names . DATASET ACTIVATE Curricula. LIST.

List |-----------------------------|---------------------------| |Output Created |02-FEB-2006 22:58:09 | |-----------------------------|---------------------------| [Curricula] CURRNUMB CURRNAME

01 Alpha 02 Beta 03 Gamma 04 Delta 05 Epsilon 06 Zeta 07 Eta 08 Theta 09 Iota 10 Kappa 11 Lambda 12 Mu 13 Nu 14 Xi 15 Omicron 16 Pi

Number of cases read: 16 Number of cases listed: 16

* The schools, with curriculum numbers attached . GET FILE=Result. DATASET NAME Result.

LIST.

List |-----------------------------|---------------------------| |Output Created |02-FEB-2006 22:58:09 | |-----------------------------|---------------------------| [Result] C:\Documents and Settings\All Users\Documents \Temporary\SPSS \2006-02-01 Madera - Random ditribution.SAV

SCHLNUMB SCHLNAME CURRNUMB

01 Alpine 02 01 Alpine 03 01 Alpine 04 01 Alpine 12 02 Bonaparte 07 02 Bonaparte 12 02 Bonaparte 15 02 Bonaparte 16 03 Celsius 05 03 Celsius 08 03 Celsius 10 03 Celsius 13 04 Davenport 08 04 Davenport 09 04 Davenport 14 04 Davenport 15 05 Equality 05 05 Equality 06 05 Equality 13 05 Equality 15

Number of cases read: 20 Number of cases listed: 20

* First, "flatten" the list of curricula, to one . * record and 16 variables. This is the lookup . * table. .

DATASET ACTIVATE Curricula. DATASET COPY Flattened. Dataset Copy |----------------------------|---------------------------| |Output Created |02-FEB-2006 22:58:09 | |----------------------------|---------------------------| DATASET ACTIVATE Flattened. STRING CURR01 TO CURR16 (A10). VECTOR CURRS=CURR01 TO CURR16. COMPUTE CURRS(CURRNUMB) = CURRNAME. COMPUTE NOBREAK=1. AGGREGATE OUTFILE=* /BREAK = NOBREAK / CURR01 TO CURR16 = MAX(CURR01 TO CURR16).

LIST CURR01 TO CURR16.

List |-----------------------------|---------------------------| |Output Created |02-FEB-2006 22:58:10 | |-----------------------------|---------------------------|

The variables are listed in the following order:

LINE 1: CURR01 CURR02 CURR03 CURR04 CURR05 CURR06 LINE 2: CURR07 CURR08 CURR09 CURR10 CURR11 CURR12 LINE 3: CURR13 CURR14 CURR15 CURR16

CURR01: Alpha Beta Gamma Delta Epsilon Zeta CURR07: Eta Theta Iota Kappa Lambda Mu CURR13: Nu Xi Omicron Pi

Number of cases read: 1 Number of cases listed: 1

* Add the lookup table to at the beginning of . * records with schools and curricula .

ADD FILES /FILE=* /FILE=Result /DROP=NOBREAK /KEEP=SCHLNUMB SCHLNAME CURRNUMB ALL. LIST /CASES=3.

List |-----------------------------|---------------------------| |Output Created |02-FEB-2006 22:58:11 | |-----------------------------|---------------------------|

The variables are listed in the following order:

LINE 1: SCHLNUMB SCHLNAME CURRNUMB CURR01 CURR02 CURR03 CURR04 LINE 2: CURR05 CURR06 CURR07 CURR08 CURR09 CURR10 LINE 3: CURR11 CURR12 CURR13 CURR14 CURR15 CURR16

SCHLNUMB: . . Alpha Beta Gamma Delta CURR05: Epsilon Zeta Eta Theta Iota Kappa CURR11: Lambda Mu Nu Xi Omicron Pi

SCHLNUMB: 01 Alpine 02 CURR05: CURR11:

SCHLNUMB: 01 Alpine 03 CURR05: CURR11:

Number of cases read: 3 Number of cases listed: 3

* 'Spread' the lookup table over all records, . * and use it to look up curriculum names .

STRING CURRNAME(A10). VECTOR CURRS = CURR01 TO CURR16.

DO IF $CASENUM > 1. . DO REPEAT CURRIC = CURR01 TO CURR16. . COMPUTE CURRIC = LAG(CURRIC). . END REPEAT. END IF.

IF NOT MISSING(CURRNUMB) CURRNAME = CURRS(CURRNUMB).

. /*-- SELECT IF NOT MISSING(SCHLNUMB).

LIST /CASES=6 /VARIABLES=SCHLNUMB SCHLNAME CURRNUMB CURRNAME.

List |-----------------------------|---------------------------| |Output Created |02-FEB-2006 22:58:11 | |-----------------------------|---------------------------| SCHLNUMB SCHLNAME CURRNUMB CURRNAME . . 01 Alpine 02 Beta 01 Alpine 03 Gamma 01 Alpine 04 Delta 01 Alpine 12 Mu 02 Bonaparte 07 Eta

Number of cases read: 6 Number of cases listed: 6

-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 1/27/2006


Back to: Top of message | Previous page | Main SPSSX-L page