Fill in the gaps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | *(Q) Someone made a file which contained Census Tract#, City Name and Zip Code. When the city is the same, it was left blank.SO IS THE CASE FOR ZIP CODE. Here I have a task to rearrange the data. *(A) posted by Raynald Levesque to SPSSX-L on 2002/02/07. * The solution is VERY GENERAL, it works (as is) for any number and any mix * of numeric and string variables. DATA LIST LIST / CT(F6.2) City (A20) Zip (F5.0). BEGIN DATA 320.11,'MODJESKA',92676 423.06 'MONARCH BEACH' 92629 423.22 423.23 626.10 'NEWPORT BEACH' 92660 626.18 627.01 627.17 630.04 630.05 630.07 630.08 630.09 630.10 631.03 627.99 ' ' 92661 628.00 630.06 ' ' 92662 628.00 ' ' 92663 629.00 630.05 630.10 634.00 635.00 636.01 636.02 636.03 626.17 ' ' 92625 626.18 627.01 627.02 626.04 'NEWPORT COAST' 92657 626.17 626.18 627.02 762.01 'OLIVE' 92865 762.02 762.98 524.12 'IRVINE' 92602 524.14 525.95 626.04 ' ' 92603 626.17 END DATA. SET ERRORS=no. DO IF $CASENUM>1. DO REPEAT v=ALL. * The next 2 lines are a nice trick: * one the 2 line results in a (non consequential) error * but the other gives the correct answer. IF LEN(RTRIM(v))=0 v=LAG(v). IF MISSING(v) v=LAG(v). END REPEAT PRINT. END IF. SET ERRORS=yes. EXECUTE. |
Related pages
...
Navigate from here