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 14:14:40 EDT
Reply-To:     James Yang <jamesy99@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         James Yang <jamesy99@HOTMAIL.COM>
Subject:      Re: Help needed!
Comments: To: WHITLOI1@WESTAT.com, ya.huang@AGOURON.COM
Content-Type: text/plain; format=flowed

Thank you all very much: Ian, Ya, Nancy, Nat, Rob, Puddin', Kelly. I learned a lot from you experts. Thanks again!

James

>From: Ian Whitlock <WHITLOI1@WESTAT.com> >To: 'Ya Huang' <ya.huang@AGOURON.COM> >CC: 'James Yang' <jamesy99@HOTMAIL.COM> >Subject: RE: Help needed! >Date: Mon, 10 Jul 2000 13:43:10 -0400 > >Ya, > >You should do it with one flag, then the code is easier to understand. > >data xx; > set xx; > retain outflg 1; > by studid; > if first.studid then outflg = 1 ; > if outflg then output ; > if grade =70 then outflg = 0 ; >run ; > >Ian Whitlock <whitloi1@westat.com> > >-----Original Message----- >From: Ya Huang [mailto:ya.huang@AGOURON.COM] >Sent: Monday, July 10, 2000 1:17 PM >To: SAS-L@LISTSERV.UGA.EDU >Subject: Re: Help needed! > > >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

________________________________________________________________________ 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