home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / bit / listserv / sasl / 5753 < prev    next >
Encoding:
Text File  |  1993-01-25  |  5.7 KB  |  132 lines

  1. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  2. Path: sparky!uunet!paladin.american.edu!auvm!!BILLS,
  3. Return-Path: <@OHSTVMA.ACS.OHIO-STATE.EDU:SAS-L@VTVM2.BITNET>
  4. X-VMS-To: INTERNET::"SAS-L@vtvm2.bitnet"
  5. MIME-version: 1.0
  6. Content-type: TEXT/PLAIN; CHARSET=US-ASCII
  7. Content-transfer-encoding: 7BIT
  8. Message-ID: <01GTXNCUY382000056@RCCW21.RTI.ORG>
  9. Newsgroups: bit.listserv.sas-l
  10. Date:         Mon, 25 Jan 1993 13:20:58 -0500
  11. Reply-To:     "Harlene C. Gogan - Go Bills,
  12.               Beat the Cowpies" <RTIHCG@RTI.BITNET>
  13. Sender:       "SAS(r) Discussion" <SAS-L@UGA.BITNET>
  14. From:         "Harlene C. Gogan - Go Bills,
  15.               Beat the Cowpies" <RTIHCG@RTI.BITNET>
  16. Subject:      Extracting data from a printed page
  17. Comments: To: SAS-L@vtvm2.bitnet
  18. Lines: 112
  19.  
  20. -----------------------------------------------
  21. SUBJECT:  Help wanted: Reading a Page as a file
  22. SUMMARY:  Extracting only certain items from a "page"
  23. REL/PLTF: VMS 6.06 or 6.07 (Irrelevant?)
  24. E-ADDR:   RTIHCG@RCC.RTI.ORG
  25. NAME:     Harlene C. Gogan
  26. PH/ADDR:  (919) 541-6565, RTI, Center for Policy Studies, PO 12194, RTP,NC 27709
  27. ------------------------------------------------
  28.  
  29. The "file" on tape is actually the picture of a printed page.  The LRECL is
  30. 132 and SAS "sees" each line as an observation.  I want to identify only
  31. specific counties, and then print only specific lines.  There is a page number
  32. in column 132 after each page break.  The information is names and addresses.
  33. There are at least 3 names and addresses for each page.  There are sometimes
  34. more than a "page" worth of names/addresses, so the page number does not
  35. always preceed a row of asterixes.
  36.  
  37. The only output I need is a listing of the "pages" for the counties I'm
  38. interested in.  I do not want to list SSNs or names if possible, but I
  39. need full addresses so I'm willing to print a few names to avoid missing
  40. a crucial piece of an address (like the name of a facility).  So I don't
  41. really need a file, except to allow me to "screen" for the value of a
  42. county.
  43.  
  44. Thanks for your help.
  45.  
  46. Here is a truncated listing of a "page" (remember, each row is an observation).
  47. I have truncated the length of each line, but not the number of lines.
  48. The lines I want to print are marked with a > in the first column.  This >
  49. does not appear in the data.
  50.  
  51.                                                          ((page no >> col 132))
  52. ************************************LAYOUT OF DATA FIELDS *********************
  53. *COMMON ADDRESS LINE SHOWS FIRST 12 POSITIONS OF MOST SIGNIFICANT ADDRESS SEGMEN
  54.    T
  55.  
  56. *   SSN           APPLICANT NAME              ZIP CODE       STATE/COUNTY
  57. *FULL ADDRESS FROM WHICH SIGNIFICANT SEGMENT WAS CHOSEN
  58. *IF ABOVE IS RESIDENT ADDRESS, THIS LINE INDICATES PAYMENT ADDRESS FOLLOWS
  59. *PAYMENT ADDRESS SHOWN HERE IF RESIDENT ADDRESS WAS USED ON LINE 2 ABOVE
  60.  
  61. ================================================================================
  62.  
  63. >COMMON ADDRESS ELEMENT FOR THIS GROUP IS RR 5
  64.  
  65. 1112223333     DOE         JANE                 11111            24006
  66. >JANE DOE           RR 5                   BX 111C              ANYCITY NC
  67.  
  68. --------------------------------------------------------------------------------
  69.  
  70. 2223334444    PUBLIC JR    JOHN       Q         11111            24006
  71. >BX 421             RR 5                   ANYCITY NC
  72. PAYMENT ADDRESS FOLLOWS
  73. >ANYCITY HOME FOR   JOHN Q PUBLIC JR       BX 421               ANYCITY NC
  74.  
  75. --------------------------------------------------------------------------------
  76.  
  77. 33344445555   MOUS         ANNE       N          11111           24006
  78. >BX 1055            RR 5                   ANYCITY NC
  79. PAYMENT ADDRESS FOLLOWS
  80. >ANDY N MOUS FOR    ANNE N NOUS            BX 1055              ANYCITY NC
  81.  
  82. --------------------------------------------------------------------------------
  83.  
  84.  
  85.  
  86.  
  87. The rest of the "page" is blank (unless there are more than 3 addresses.  The
  88. next page always begins with a page number in col 132.  Then if a NEW
  89. "common address" the row of asterixes and a repeat of the record layout.
  90.  
  91.  
  92. I want the output to be the following (if within the county).
  93.  
  94. COMMON ADDRESS ELEMENT FOR THIS GROUP IS RR 5
  95. JANE DOE           RR 5                   BX 111C              ANYCITY NC
  96. BX 421             RR 5                   ANYCITY NC
  97. ANYCITY HOME FOR   JOHN Q PUBLIC JR       BX 421               ANYCITY NC
  98. BX 1055            RR 5                   ANYCITY NC
  99. ANDY N MOUS FOR    ANNE N NOUS            BX 1055              ANYCITY NC
  100.  
  101. and then continue for the next common address within "my" counties, with
  102. a blank line between "COMMON"s.  I want all the address lines if there are
  103. more than 3 within the "COMMON" address.
  104.  
  105. My code generation so far (and I'm getting hung up on the treating this
  106.    as a "data file" for output versus just creating a "report" ) is.....
  107.  
  108. FILENAME nctape 'file spec here';
  109.  
  110. DATA temp;       /*should I use _null_?*/
  111. INFILE nctape;
  112. INPUT tag $ 1-6 @;
  113.      if tag='COMMON' then do;         /*following col locations are correct*/
  114.                                       /*my example may be faulty*/
  115.              INPUT @42 COMMADD $CHAR40. / /
  116.                    @52 zipcode
  117.                    @70 state  2.0
  118.                    @72 county 3.0   @;
  119.          if county=005 or county=027 or [...list of all counties wanted..]
  120.             then do;
  121.               input / check $ 1-7@;
  122.                  if check in ('       ','PAYMENT','-------') then delete;
  123.                  else ???????       /*PUT _all_ ????_infile_?????*/
  124.                 /*Here's where my thinking breaks down--*/
  125.                 /*how do I eliminate the rows strating with SSN???*/
  126.                 /*Is there a way for SAS to recognize a CHAR that is*/
  127.                 /*really a numeric????*/
  128.                  end;
  129.          else delete;
  130.                            end;
  131.      else delete;
  132.