home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: bit.listserv.sas-l
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!alspach
- From: alspach@casbah.acns.nwu.edu (Steve Alspach)
- Subject: Problem with Data step loop
- Message-ID: <1992Jul31.195222.7719@news.acns.nwu.edu>
- Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
- Organization: Northwestern University, Evanston Illinois.
- Date: Fri, 31 Jul 1992 19:52:22 GMT
- Lines: 54
-
- To whom it may concern,
-
- This is Steve Alspach from Northwestern University. Some time ago we had a
- user try to read a file from tape using SAS. The file has 299,469
- observations in it. The SAS program used to read the data keeps trying to
- read one case more than what exists. We checked the tape and it seems to be
- fine. The DATA step is rather involved and looks like this:
-
- DATA SASDATA.CPS;
- INFILE CPSADF84 LRECL=390 BLKSIZE=30420 RECFM=FB;
- YR=84;
- KEEP YR PTYPE AGE RACE SEX ED WKS HRWK IND OCC CLSWKR
- EARN WAGSAL PWT;
- IF (YR GT 76) THEN LINK LOOP1;
- RETURN;
- LOOP1:
- INPUT REC 331 @;
- SELECT (REC);
- WHEN (1) DO; INPUT; GO TO LOOP1; END;
- WHEN (2) DO; INPUT; GO TO LOOP1; END;
- WHEN (3) DO;
- INPUT AGE 110-111 PTYPE 102 CLSWKR 150 @:
- IF (PTYPE=1) AND ((AGE GE 18) AND (AGE LE 65))
- AND ((CLSWKR GE 1) AND (CLSWKR LE 4) THEN DO;
- LINK LOOP10; GO TO LOOP1; END;
- ELSE DO; INPUT; GO TO LOOP1; END;
- END;
- OTHERWISE;
- END;
-
- LOOP10:
- INPUT SEX 108 RACE 109 EDCMPLTD 117 WKS 134-135 IND 151-153
- OCC 154-156 WAGSAL 191-195 PWT 118-128 @;
- IF (YR LT 81) THEN INPUT EARN 254-260;
- IF (YR GE 81) THEN INPUT EARN 255-261;
- IF (EARN GT 0) AND (WKS GE 0) THEN OUTPUT;
- RETURN;
-
- The error message that we get is that there is a lost card, and looks like
- this:
-
- RULE: ----+----1----+----2----+----3----+----4----+----5----+----6
- 299470
- YR=84 REC=3 AGE=32...
- _ERROR_=1 _N_=1
-
- Why is SAS looking for Record no. 299470? It's making one more iteration
- through the DATA step than it is supposed to. Any help you can give on this
- is greatly appreciated.
-
- Steve Alspach
- Northwestern University
- alspach@casbah.acns.nwu.edu
-
-