|Date: ||Sat, 17 Jun 2000 17:53:16 -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: feasibility question|
|Content-type: ||text/plain; charset=iso-8859-1|
I believe the following syntax does the job for one variable.
* Define a data file for illustration purposes.
loop casenum=1 to 100.
end input program.
*It is important to define this dummy variable in the main data file.
* Say you need to determine deciles (divide data in 10 pieces) based on
cases where class1=1.
* and that you must then recode ALL values of draw usign the break points
obtained using cases where class1=0.
SELECT IF class1=0.
SORT CASES BY draw.
* Number cases and calculate number of cases.
RANK draw /n INTO n.
* In next line, change the number 10 by the number you need.
* balance of paragraph finds the cut off points.
/cut_off = FIRST(draw).
* prepare cut off points data for merger with main data file.
SAVE OUTFILE='cutoff points.sav'.
*add cut_off points to original data file.
MATCH FILES /FILE=*
/TABLE='C:\Program Files\SPSS\cutoff points.sav'
DEFINE !rank_it (vname=!TOKENS(1)
VECTOR cutoff=var001 TO !CONCAT('var',!nb_bins).
LOOP #cnt=2 TO !nb_bins.
COMPUTE rank1=rank1 + (!vname>cutoff(#cnt)).
* Note: in the macro calls, the argument of nb_bins must have 3 characters,
eg for 5 use 005, for 15 use 015, etc.
!rank_it vname=draw nb_bins=010 .
Raynald Levesque firstname.lastname@example.org
----- Original Message -----
From: S. Zitzer <sallyz@U.WASHINGTON.EDU>
Sent: Tuesday, June 13, 2000 10:00 AM
Subject: feasibility question
> I have a user who wants to find percentile cutpoints for a lot of
> variables using one group of cases, then recode that group plus the rest
> of her data into categories using those cutpoints. I told her Frequencies
> would give her the cutpoints. She wanted to know if there were an easier
> way to do the RECODES than manually editing a syntax file as she has lots
> of variables. Does anyone have any ideas?
> Univ. of Washington, Seattle, WA, USA