Return-Path: <@OHSTVMA.ACS.OHIO-STATE.EDU:SAS-L@VTVM2.BITNET>
X-VMS-To: INTERNET::"SAS-L@vtvm2.bitnet"
MIME-version: 1.0
Content-type: TEXT/PLAIN; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT
Newsgroups: bit.listserv.sas-l
Date:         Mon, 25 Jan 1993 13:20:58 -0500
Reply-To:     "Harlene C. Gogan - Go Bills,
              Beat the Cowpies" <RTIHCG@RTI.BITNET>
From:         "Harlene C. Gogan - Go Bills,
              Beat the Cowpies" <RTIHCG@RTI.BITNET>
Subject:      Extracting data from a printed page
Comments: To: SAS-L@vtvm2.bitnet

-----------------------------------------------
SUBJECT:  Help wanted: Reading a Page as a file
SUMMARY:  Extracting only certain items from a "page"
REL/PLTF: VMS 6.06 or 6.07 (Irrelevant?)
E-ADDR:   RTIHCG@RCC.RTI.ORG
NAME:     Harlene C. Gogan
PH/ADDR:  (919) 541-6565, RTI, Center for Policy Studies, PO 12194, RTP,NC 27709
------------------------------------------------

The "file" on tape is actually the picture of a printed page.  The LRECL is
132 and SAS "sees" each line as an observation.  I want to identify only
specific counties, and then print only specific lines.  There is a page number
in column 132 after each page break.  The information is names and addresses.
There are at least 3 names and addresses for each page.  There are sometimes
more than a "page" worth of names/addresses, so the page number does not
always preceed a row of asterixes.

The only output I need is a listing of the "pages" for the counties I'm
interested in.  I do not want to list SSNs or names if possible, but I
need full addresses so I'm willing to print a few names to avoid missing
a crucial piece of an address (like the name of a facility).  So I don't
really need a file, except to allow me to "screen" for the value of a
county.

Thanks for your help.

Here is a truncated listing of a "page" (remember, each row is an observation).
I have truncated the length of each line, but not the number of lines.
The lines I want to print are marked with a > in the first column.  This >
does not appear in the data.

                                                         ((page no >> col 132))
************************************LAYOUT OF DATA FIELDS *********************
*COMMON ADDRESS LINE SHOWS FIRST 12 POSITIONS OF MOST SIGNIFICANT ADDRESS SEGMEN
   T

*   SSN           APPLICANT NAME              ZIP CODE       STATE/COUNTY
*FULL ADDRESS FROM WHICH SIGNIFICANT SEGMENT WAS CHOSEN
*IF ABOVE IS RESIDENT ADDRESS, THIS LINE INDICATES PAYMENT ADDRESS FOLLOWS
*PAYMENT ADDRESS SHOWN HERE IF RESIDENT ADDRESS WAS USED ON LINE 2 ABOVE

================================================================================

>COMMON ADDRESS ELEMENT FOR THIS GROUP IS RR 5

1112223333     DOE         JANE                 11111            24006
>JANE DOE           RR 5                   BX 111C              ANYCITY NC

--------------------------------------------------------------------------------

2223334444    PUBLIC JR    JOHN       Q         11111            24006
>BX 421             RR 5                   ANYCITY NC
PAYMENT ADDRESS FOLLOWS
>ANYCITY HOME FOR   JOHN Q PUBLIC JR       BX 421               ANYCITY NC

--------------------------------------------------------------------------------

33344445555   MOUS         ANNE       N          11111           24006
>BX 1055            RR 5                   ANYCITY NC
PAYMENT ADDRESS FOLLOWS
>ANDY N MOUS FOR    ANNE N NOUS            BX 1055              ANYCITY NC

--------------------------------------------------------------------------------




The rest of the "page" is blank (unless there are more than 3 addresses.  The
next page always begins with a page number in col 132.  Then if a NEW
"common address" the row of asterixes and a repeat of the record layout.


I want the output to be the following (if within the county).

COMMON ADDRESS ELEMENT FOR THIS GROUP IS RR 5
JANE DOE           RR 5                   BX 111C              ANYCITY NC
BX 421             RR 5                   ANYCITY NC
ANYCITY HOME FOR   JOHN Q PUBLIC JR       BX 421               ANYCITY NC
BX 1055            RR 5                   ANYCITY NC
ANDY N MOUS FOR    ANNE N NOUS            BX 1055              ANYCITY NC

and then continue for the next common address within "my" counties, with
a blank line between "COMMON"s.  I want all the address lines if there are
more than 3 within the "COMMON" address.

My code generation so far (and I'm getting hung up on the treating this
   as a "data file" for output versus just creating a "report" ) is.....

FILENAME nctape 'file spec here';

DATA temp;       /*should I use _null_?*/
INFILE nctape;
INPUT tag $ 1-6 @;
     if tag='COMMON' then do;         /*following col locations are correct*/
                                      /*my example may be faulty*/
             INPUT @42 COMMADD $CHAR40. / /
                   @52 zipcode
                   @70 state  2.0
                   @72 county 3.0   @;
         if county=005 or county=027 or [...list of all counties wanted..]
            then do;
              input / check $ 1-7@;
                 if check in ('       ','PAYMENT','-------') then delete;
                 else ???????       /*PUT _all_ ????_infile_?????*/
                /*Here's where my thinking breaks down--*/
                /*how do I eliminate the rows strating with SSN???*/
                /*Is there a way for SAS to recognize a CHAR that is*/
                /*really a numeric????*/
                 end;
         else delete;
                           end;
     else delete;
Newsgroups: bit.listserv.sas-l