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 (July 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 10 Jul 2000 10:16:35 -0700
Reply-To:   Ya Huang <ya.huang@AGOURON.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ya Huang <ya.huang@AGOURON.COM>
Subject:   Re: Help needed!
Content-Type:   text/plain; charset=us-ascii

James, try the following:

data xx; input studID $ GRADE; cards; 01 90 01 96 01 70 01 50 01 70 02 80 02 70 02 90 02 76 ;

data xx; set xx; retain flag1 flag2; by studid; if first.studid then do; flag1=0; flag2=0; end; if grade =70 then do; flag1=1; flag2+1; end; if flag2 gt 0 then flag2+1; if flag1 and flag2 > 2 then delete;

options nocenter;

proc print; run;

--------------------------------------- OBS STUDID GRADE FLAG1 FLAG2

1 01 90 0 0 2 01 96 0 0 3 01 70 1 2 4 02 80 0 0 5 02 70 1 2

James Yang wrote: > > I have following dataset: J1 with 2 vars: > > StudID GRADE > 01 90 > 01 96 > 01 70 > 01 50 > 01 70 > 02 80 > 02 70 > 02 90 > 02 76 > > What I want to do now is: for a given student, all records after the first > time grade=70 are deleted. That is, for this specific example, following > will be my expected output dataset: > > StudID GRADE > 01 90 > 01 96 > 01 70 > 02 80 > 02 70 > > How can make this efficiently? Any advice is appreciated in advance. > > James > > ________________________________________________________________________ > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


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