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 (June 2000)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 4 Jun 2000 10:05:41 -0400
Reply-To:   Raynald Levesque <rlevesque@VIDEOTRON.CA>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Raynald Levesque <rlevesque@VIDEOTRON.CA>
Subject:   Re: Recoding with scripts
Content-type:   text/plain; charset=iso-8859-1

Hi Mark and Sorin,

Regarding Sorin's question 2 below:

* To rank a var1 based on equal distances between min and max value of var1.

DATA LIST FREE /var1(F8). BEGIN DATA. 0 15 31 91 17 24 29 98 57 90 6 7 100 24 74 21 END DATA. LIST.

COMPUTE dummy=1.

AGGREGATE /OUTFILE='min_max.SAV' /BREAK=dummy /var1_min = MIN(var1) /var1_max = MAX(var1).

MATCH FILES /FILE=* /TABLE='min_max.SAV' /BY dummy.

*Lets say you want to separate values in 8 intervals. COMPUTE #delta=(var1_max - var1_min)/8. COMPUTE inter=MIN(TRUNC(var1/#delta)+1,8). EXECUTE.

A short technical note: The intervals are closed on the left and opened on the right. Thus, inter=1 when var1 is in the interval [var1_min, var1_min + 1*#delta) inter=2 when var1 is in the interval [var1_min+1*delta, var1_min + 2*#delta) ... inter=8 when var1 is in the interval [var1_min+7*delta, var1_min + 8*#delta) inter=9 when var1= var1_max.

The purpose of the last COMPUTE is to force cases with var1=var1_max into the interval 8. In other words inter =8 is for cases in the closed interval [var1_min+7*delta, var1_min + 8*#delta].

One impecfect method to avoid this adjustment would be to define delta as follows: COMPUTE #delta=1.000001*(var1_max - var1_min)/8.


Raynald Levesque

----- Original Message ----- From: Mark Casazza Newsgroups: bit.listserv.spssx-l To: SPSSX-L@LISTSERV.UGA.EDU Sent: Tuesday, May 23, 2000 9:33 AM Subject: Re: Recoding with scripts


The first is easy enough if you use the /NTILES subcommand with the RANK command. It would look like this:


This would produce 4 values for R_SCORE (1,2,3,4) based on quartiles of score. You can use any number of partitions by changing the "4" after NTILES. As for the second question, I don't have a quick answer maybe someone else does.


At 04:48 AM 2000-05-23 , Sorin Sion wrote:

Hi list!

Is there any way to create a new variable at ordinal level, based on a scale-level variable? To be more specific, if you have a continuous variation variable, is it possible to create a new variable with values that are: 1. quantiles of the variable 2. codes that represents equal intervals between the min and the max of the variable.

I suppose this can be done with scripts. In the first case, it would require the number of quantiles and in the second case the number of intervals needed.

Thanks in advance for any tip.

Sorin SION Market Research Analyst MobiFon S.A. - ROMANIA GSM: (+4)092.628.309 Tel: (+401)302.18.15 Fax: (+401)302.14.63

Mark V. Casazza Senior Research Analyst Office of Research, Assessment and Planning Adelphi University, Levermore Hall #307 Garden City, NY 11530

phone: 516.877.3231 fax: 516.877.3237 email:

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