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 (February 1997, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 7 Feb 1997 10:23:14 -0800
Reply-To:     gxx18300@ggr.co.uk, BWRogers@MSN.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Bruce Rogers <gxx18300@GGR.CO.UK>
Organization: Medical IR, Glaxo Wellcome
Subject:      Re: adding records to a dataset
Comments: To: jupiterbowl <scot@wam.umd.edu>
Content-Type: text/plain; charset=us-ascii

jupiterbowl wrote: >

> Is there a general strategy for adding records to reflect a missing value > for SCORE in the missing months (Months 2,4-11 in the above case), besides > editing the dataset the hard way? >

Scot

There are several ways of doing this in a data step, one of which I've included below (there may be better ways, but I don't have time to examine all the possibilities right now) . I think it's pretty self-explanatory, but if not email me and I'll fill in the details.

data new ; set old; by client ; drop stormon storscor prevmon ;

prevmon = lag(month) ; stormon = month ; storscor = score ;

if first.client then prevmon = 0 ; do month = (prevmon+1) to (stormon-1) ; score = . ; output ; end;

score = storscor ; month = stormon ; output ;

if last.client & month ^= 12 then do month = (stormon+1) to 12 ; score = . ; output ; end; run;


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