home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / bit / listserv / sasl / 3531 < prev    next >
Encoding:
Text File  |  1992-07-31  |  2.0 KB  |  65 lines

  1. Newsgroups: bit.listserv.sas-l
  2. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!casbah.acns.nwu.edu!alspach
  3. From: alspach@casbah.acns.nwu.edu (Steve Alspach)
  4. Subject: Problem with Data step loop
  5. Message-ID: <1992Jul31.195222.7719@news.acns.nwu.edu>
  6. Sender: usenet@news.acns.nwu.edu (Usenet on news.acns)
  7. Organization: Northwestern University, Evanston Illinois.
  8. Date: Fri, 31 Jul 1992 19:52:22 GMT
  9. Lines: 54
  10.  
  11. To whom it may concern,
  12.  
  13. This is Steve Alspach from Northwestern University.  Some time ago we had a
  14. user try to read a file from tape using SAS.  The file has 299,469
  15. observations in it.  The SAS program used to read the data keeps trying to
  16. read one case more than what exists.  We checked the tape and it seems to be
  17. fine.  The DATA step is rather involved and looks like this:
  18.  
  19. DATA SASDATA.CPS;
  20. INFILE CPSADF84 LRECL=390 BLKSIZE=30420 RECFM=FB;
  21. YR=84;
  22. KEEP YR PTYPE AGE RACE SEX ED WKS HRWK IND OCC CLSWKR
  23.   EARN WAGSAL PWT;
  24. IF (YR GT 76) THEN LINK LOOP1;
  25. RETURN;
  26. LOOP1:
  27.   INPUT REC 331 @;
  28.   SELECT (REC);
  29.   WHEN (1) DO; INPUT; GO TO LOOP1; END;
  30.   WHEN (2) DO; INPUT; GO TO LOOP1; END;
  31.   WHEN (3) DO;
  32.   INPUT AGE 110-111 PTYPE 102 CLSWKR 150 @:
  33.   IF (PTYPE=1) AND ((AGE GE 18) AND (AGE LE 65))
  34.     AND ((CLSWKR GE 1) AND (CLSWKR LE 4) THEN DO;
  35.   LINK LOOP10; GO TO LOOP1; END;
  36.   ELSE DO; INPUT; GO TO LOOP1; END;
  37. END;
  38. OTHERWISE;
  39. END;
  40.  
  41. LOOP10:
  42.   INPUT SEX 108 RACE 109 EDCMPLTD 117 WKS 134-135 IND 151-153
  43.   OCC 154-156 WAGSAL 191-195 PWT 118-128 @;
  44.   IF (YR LT 81) THEN INPUT EARN 254-260;
  45.   IF (YR GE 81) THEN INPUT EARN 255-261;
  46.   IF (EARN GT 0) AND (WKS GE 0) THEN OUTPUT;
  47. RETURN;
  48.  
  49. The error message that we get is that there is a lost card, and looks like
  50. this:
  51.  
  52. RULE:    ----+----1----+----2----+----3----+----4----+----5----+----6
  53. 299470
  54. YR=84 REC=3 AGE=32...
  55. _ERROR_=1 _N_=1
  56.  
  57. Why is SAS looking for Record no. 299470?  It's making one more iteration
  58. through the DATA step than it is supposed to.  Any help you can give on this
  59. is greatly appreciated.
  60.  
  61. Steve Alspach
  62. Northwestern University
  63. alspach@casbah.acns.nwu.edu
  64.  
  65.