Read ASCII file using INPUT PROGRAM
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | * This came from Neila Nessa (neilanessa@email.msn.com) 2000/01/10 comp.soft-sys.stat.spss. new file. set mprint=on /printback=on. INPUT PROGRAM . NUMERIC #EOF . VECTOR NodeI_(25) NodeJ_(25) WT_(25). LOOP . ** Initialize Case ** . - LOOP # = 1 TO 25. - DO REPEAT V = NodeI_ NodeJ_ WT_ . - COMPUTE V(#) = $SYSMIS . - END REPEAT . - END LOOP. ** SKIP THE HEADER ** . - LOOP #=1 TO 2 . - DATA LIST END=#EOF / #JUNK (A50). - PRINT /"JUNK" # #JUNK . - END LOOP. ** READ THE LINK COUNT ** . - DATA LIST / #LINKS (F3) . - PRINT /"LINKS" # #LINKS . ** SKIP MORE JUNK ** . - LOOP #=1 TO 4 . - DATA LIST / #JUNK (A50). - PRINT / "JUNK" # #JUNK . - END LOOP. ** READ THE DATA ** . - LOOP #=1 TO #LINKS . - DATA LIST LIST / #Ni #Nj #WT . - COMPUTE NodeI_(#) = #Ni . - COMPUTE NodeJ_(#) = #Nj . - COMPUTE WT_(#) = #WT . - PRINT /# #Ni #Nj #WT . - LEAVE NodeI_1 TO NodeI_25 NodeJ_1 To NodeJ_25 WT_1 To WT_25 . - END LOOP. ** DONE WITH THAT CASE! *. - END CASE. END LOOP IF #EOF . END FILE. END INPUT PROGRAM. BEGIN DATA PFNET D:\\SHARON\\PCKNOT\\DD\\M19A.PRX 16 nodes 19 links 1 minimum link weight 3 maximum link weight links: node1 node2 Weight type 1 2 1 x 1 10 1 x 2 5 1 x 2 7 1 x 2 16 1 x 3 13 3 x 4 9 2 x 4 10 2 x 4 16 2 x 5 7 1 x 5 11 2 x 5 15 1 x 6 8 3 x 7 11 2 x 8 12 2 x 9 14 2 x 11 15 2 x 12 13 2 x 13 14 2 x PFNET D:\\SHARON\\PCKNOT\\DD\\M19B.PRX 16 nodes 15 links 1 minimum link weight 3 maximum link weight links: node1 node2 Weight type 1 2 1 x 2 10 1 x 3 5 1 x 3 7 1 x 3 16 1 x 4 13 3 x 5 9 2 x 5 10 2 x 6 7 1 x 7 8 3 x 8 11 2 x 9 12 2 x 10 14 2 x 12 15 2 x 13 14 2 x END DATA. EXE . |
Related pages
...