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 (November 2003)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 20 Nov 2003 17:47:54 -0500
Reply-To:     Raynald Levesque <rlevesque@videotron.ca>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Raynald Levesque <rlevesque@videotron.ca>
Subject:      Re: transform values
In-Reply-To:  <000e01c3aed0$56c53060$2201a8c0@HSRIEAST.HSRI.ORG>
Content-type: text/plain; charset=US-ASCII

Hi

The following macro does it automatically for you:

GET FILE='c:\program files\spss\employee data.sav'.

*/////////////. DEFINE !rescale (var=!TOKENS(1) /newvar=!TOKENS(1)) SAVE OUTFILE='c:\temp\data file.sav'. COMPUTE nobreak=1. AGGREGATE OUTFILE=* /PRESORTED /BREAK=nobreak /min=MIN(!var) /max=MAX(!var). COMPUTE range=max-min. WRITE OUTFILE="C:\temp\rescale.sps" /"COMPUTE " !QUOTE(!newvar) "=(" !QUOTE(!var) "-" min(F12.11) ")/" range(F12.11) ".". EXECUTE. GET FILE='c:\temp\data file.sav'. INCLUDE "C:\temp\rescale.sps". !ENDDEFINE. */////////////.

* example rescale salary to be between 0 and 1. SET MPRINT=yes. !rescale var=salary newvar=salary2. SET MPRINT=no. * show that it works. GRAPH /SCATTERPLOT(BIVAR)=salary WITH salary2 /MISSING=LISTWISE .

* example rescale salbegin to be between 0 and 1. SET MPRINT=yes. !rescale var=salbegin newvar=salbegin2. SET MPRINT=no. * show that it works. GRAPH /SCATTERPLOT(BIVAR)=salbegin WITH salbegin2 /MISSING=LISTWISE .

Regards

Raynald Levesque rlevesque@videotron.ca Visit my SPSS site: http://pages.infinit.net/rlevesqu/

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU]On Behalf Of Giuseppina Chiri Sent: November 19, 2003 2:07 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: transform values

Dear list, I have four scales whose minimum and maximum values are different. I would like to change them so they all range from 0 to 1. What I have been doing is writing a syntax code for each of the scales with their minimum values in the expression and then dividing everything by their range (e.g. COMPUTE scale2 = (scale1-0.13)/0.6). Is there a way to do this so I don't have to manually enter the values for each scale? Any help is greatly appreciated. Giusi


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