LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2003, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 29 Apr 2003 11:24:53 -0400
Reply-To:   "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject:   Re: Missing rows
Content-Type:   text/plain; charset="iso-8859-1"

Rune:

It is also easy to submit fairly basic programming / logic questions to the list, perhaps easier than solving your own problems.

If there is any question about the order of year / seq in the input dataset / cards, a sort ought to be added before the 'data missing' step.

data a; input year seq; cards; 1994 2 <many cards snipped> 1998 38 run;

data missing ( keep = year missing_seq ); set a; by year;

do missing_seq = sum(lag(seq) * not(first.year),1 ) to ( seq - 1 ); output ; end; run;

options nocenter; proc print data=missing; run;

The SAS System 07:49 Tuesday, April 29, 2003 1

missing_ Obs year seq

1 1994 1 2 1994 41 3 1994 52 4 1994 68 5 1994 93 6 1994 94 7 1994 110 8 1995 30 9 1995 39 10 1995 40 11 1995 53 12 1995 59 13 1995 63 14 1998 1 15 1998 2 16 1998 3 17 1998 4 18 1998 5 19 1998 6 20 1998 7 21 1998 8 22 1998 9 23 1998 10 24 1998 11 25 1998 12 26 1998 13 27 1998 14 28 1998 15 29 1998 16 30 1998 17 31 1998 18 32 1998 19 33 1998 20 34 1998 21 35 1998 22 36 1998 23 37 1998 27

-----Original Message----- From: Rune Runnestoe [mailto:rune@FASTLANE.NO] Sent: Tuesday, April 29, 2003 10:31 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Missing rows

Hello, can anyone help me with a code that outputs the missing rows according to the following rules: 1. Each Seq shall start with 1 and increment by 1 within each year 2. The last SakSeqNum within each Year is the upper limit 3. Both Year and Seq is numeric 4. If a hole consists of many subseqent missing seq, each of the missing rows shall be outputted.

I must say that I have asked for a solution to this problem before in this usergroup, and there has been several solutions, but so far none has done what they were supposed to do. It is easy to make suggestions, but please test it, too. Especially demand nr. 4 does has never worked in any solution so far.

Here is the real data to test:

Year Seq

1994 2 1994 3 1994 4 1994 5 1994 6 1994 7 1994 8 1994 9 1994 10 1994 11 1994 12 1994 13 1994 14 1994 15 1994 16 1994 17 1994 18 1994 19 1994 20 1994 21 1994 22 1994 23 1994 24 1994 25 1994 26 1994 27 1994 28 1994 29 1994 30 1994 31 1994 32 1994 33 1994 34 1994 35 1994 36 1994 37 1994 38 1994 39 1994 40 1994 42 1994 43 1994 44 1994 45 1994 46 1994 47 1994 48 1994 49 1994 50 1994 51 1994 53 1994 54 1994 55 1994 56 1994 57 1994 58 1994 59 1994 60 1994 61 1994 62 1994 63 1994 64 1994 65 1994 66 1994 67 1994 69 1994 70 1994 71 1994 72 1994 73 1994 74 1994 75 1994 76 1994 77 1994 78 1994 79 1994 80 1994 81 1994 82 1994 83 1994 84 1994 85 1994 86 1994 87 1994 88 1994 89 1994 90 1994 91 1994 92 1994 95 1994 96 1994 97 1994 98 1994 99 1994 100 1994 101 1994 102 1994 103 1994 104 1994 105 1994 106 1994 107 1994 108 1994 109 1994 111 1994 112 1994 113 1994 114 1994 115 1994 116 1995 1 1995 2 1995 3 1995 4 1995 5 1995 6 1995 7 1995 8 1995 9 1995 10 1995 11 1995 12 1995 13 1995 14 1995 15 1995 16 1995 17 1995 18 1995 19 1995 20 1995 21 1995 22 1995 23 1995 24 1995 25 1995 26 1995 27 1995 28 1995 29 1995 31 1995 32 1995 33 1995 34 1995 35 1995 36 1995 37 1995 38 1995 41 1995 42 1995 43 1995 44 1995 45 1995 46 1995 47 1995 48 1995 49 1995 50 1995 51 1995 52 1995 54 1995 55 1995 56 1995 57 1995 58 1995 60 1995 61 1995 62 1995 64 1998 24 1998 25 1998 26 1998 28 1998 29 1998 30 1998 31 1998 32 1998 33 1998 34 1998 35 1998 36 1998 37 1998 38

Regards Rune Runnestoe


Back to: Top of message | Previous page | Main SAS-L page