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 (July 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 12 Jul 2005 16:20:51 -0400
Reply-To:   Richard Ristow <wrristow@mindspring.com>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Richard Ristow <wrristow@mindspring.com>
Subject:   Re: start with blank data file
Comments:   To: Kim Jinnett <kjinnett@ibiweb.org>
In-Reply-To:   <MPECLJPOAEIJAOCEBHBJCEEGCBAA.kjinnett@ibiweb.org>
Content-Type:   text/plain; charset="us-ascii"; format=flowed

At 03:16 PM 7/12/2005, Kim Jinnett wrote:

>If possible, I'd like to begin creating a data file from a blank data >screen. I have no data records at present and simply want to create a >list of 500 random unique IDs to start. Others have been so kind as >to tell me how to create random unique IDs: > >compute rand=uniform(1). >sort cases by rand. >compute id=$casenum.

Glad I read this! I was about to send exactly this solution, to your earlier posting.

>What is the file-related syntax preceding these statements so that I >can invoke a blank data file and start from scratch. Is that possible?

You do this sort of thing with an INPUT PROGRAM. Here's (untested) code:

NEW FILE. INPUT PROGRAM. NUMERIC ID(N4). LOOP #CASE = 1 TO 500. . COMPUTE ID = 0. . END CASE. END LOOP. END FILE. END INPUT PROGRAM. * And, as before, . compute rand=uniform(1). sort cases by rand. compute id=$casenum.

HOWEVER: what does this buy you? That is, how does 500 empty cases in 'random' order, but numbered 1 to 500 in that order, differ from 500 empty cases numbered 1 to 500?.

Perhaps you want the number 1 to 500 in random order in in the data editor, like this (still untested)?

NEW FILE. INPUT PROGRAM. NUMERIC ID(N4). LOOP #CASE = 1 TO 500. . COMPUTE ID = #CASE. . END CASE. END LOOP. END FILE. END INPUT PROGRAM. * And, as before, . compute rand=uniform(1). sort cases by rand.

You'll have variable 'rand' in your file, that you'll probably want to drop.


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