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 (May 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 11 May 2010 15:39:06 -0500
Reply-To:     Yu Zhang <zhangyu05@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Yu Zhang <zhangyu05@GMAIL.COM>
Subject:      Re: Data manipulation help
Comments: To: Michael Bryce Herrington <mherrin@g.clemson.edu>
In-Reply-To:  <AANLkTinokMteLB9k-lN5kPMNiMybAc__nkNpPqkYG5dU@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

proc sort data=sample; by name date; run;

data want;

datenum+1;

do until(last.date); set sample; by name date; if pdate<date then output; end; if last.name then datenum=0; run;

On Tue, May 11, 2010 at 11:27 AM, Michael Bryce Herrington < mherrin@g.clemson.edu> wrote:

> Hey everyone, > > I need some help manipulating my data so I can try something. I have > included a sample below and a sample of what I want it to look like in the > end. The main goal is that I want to append each date group with ALL > records that have pdate<date. I would also like to include a new variable > which counts the date groups so I can see them more easily and know this > number. Also, in my actual data set I have multiple "name" values so I > would need some sort of "by name;" line. Thanks for your help. > > * > > data* sample; > > input name $ date pdate score; > > datalines; > > alpha 15165 15147 75 > > alpha 15165 15130 76 > > alpha 15165 15106 58 > > alpha 15165 15083 83 > > alpha 15165 15069 67 > > alpha 15165 15037 63 > > alpha 15178 15165 80 > > alpha 15178 15147 75 > > alpha 15178 15130 76 > > alpha 15178 15106 58 > > alpha 15178 15083 83 > > alpha 15178 15069 67 > > alpha 15203 15178 69 > > alpha 15203 15165 80 > > alpha 15203 15147 75 > > alpha 15203 15130 76 > > alpha 15203 15106 58 > > alpha 15203 15083 83 > > ; > * > > run*; > * > > data* want; > > input name $ datenum date pdate score; > > datalines; > > alpha 1 15165 15147 75 > > alpha 1 15165 15130 76 > > alpha 1 15165 15106 58 > > alpha 1 15165 15083 83 > > alpha 1 15165 15069 67 > > alpha 1 15165 15037 63 > > alpha 2 15178 15165 80 > > alpha 2 15178 15147 75 > > alpha 2 15178 15130 76 > > alpha 2 15178 15106 58 > > alpha 2 15178 15083 83 > > alpha 2 15178 15069 67 > > alpha 2 15178 15037 63 > > alpha 3 15203 15178 69 > > alpha 3 15203 15165 80 > > alpha 3 15203 15147 75 > > alpha 3 15203 15130 76 > > alpha 3 15203 15106 58 > > alpha 3 15203 15083 83 > > alpha 3 15203 15069 67 > > alpha 3 15203 15037 63 > > ; > * > > run*; > > -- > Bryce Herrington > Clemson University > mherrin@g.clemson.edu > (863) 258-4758 >


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