For some reason this did not get posted yesterday.
So I am sending it with a new title.
To minimize keying so that you only need to enter the from your first table. Each year you could put the ranges for the levels into a separate file. In that file you could find the values that designate 1/3 points of the predefined ranges for the levels. For each grade you calculate 12 pairs of variables. the upper and lower limits for your new ranges. compute lower1 = bound1. compute upper1 = bound1 + ((bound2-bound1)/3). ... Match those onto each case by grade. then something like do if range(testscore, lower1, upper1). compute level =1. compute rangethird=1 else if range(testscore,lower2,upper2). compute level=1 compute rangethird=2. ... else. compute level =-1. print /' OOPS!' id testscore ' score not in any range' end if. missing value level (-1). Art Kendall Social Research Consultants ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Art Kendall
Social Research Consultants |
Administrator
|
FWIW:
Here is a cleaned up generalized and tested version of the MACRO I posted yesterday. --- DEFINE Trisect (OldVar =!TOKENS(1)/ NewVar =!TOKENS(1)/ COND=!ENCLOSE("[","]")/ Ranges !CMDEND ) . !LET !L=!NULL !DO !I !IN (!RANGES) !LET !L=!CONCAT(!L,"X") !DOEND VECTOR #Range(!LENGTH(!L)). DO IF (!COND). + DO REPEAT #=1 TO !LENGTH(!L) / R=!Ranges . + COMPUTE #Range(#)=R. + END REPEAT. + LOOP #=1 TO !LENGTH(!L) -1. + COMPUTE #LO= #Range(#) . + COMPUTE #INT=(#Range(#+1)-#Range(#))/3 . + LOOP ##=1 TO 3. + IF Range(!OldVar,#LO,#LO+#INT) !NewVar=(#-1)*3 + ##. + COMPUTE #LO=#LO+#INT. + END LOOP. + END LOOP. END IF. !ENDDEFINE . DATA LIST FREE / MyOldVar. begin data 457 453 646 252 542 547 254 625 462 354 623 564 267 456 724 672 354 672 364 526 452 367 456 723 546 723 546 723 546 723 576 425 642 674 623 643 727 462 747 547 275 376 347 287 777 end data. compute GROUP=1. set mprint on. Trisect NewVar= MyNewVar OldVar=MyOldVar COND =[GROUP=1] Ranges 475 643 662 694 780 .
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |