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 (December 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 5 Dec 2006 20:19:23 +0000
Reply-To:   toby dunn <tobydunn@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   toby dunn <tobydunn@HOTMAIL.COM>
Subject:   Re: Autofill empty fields
Comments:   To: ssegall@GMAIL.COM
In-Reply-To:   <1165349193.738127.249370@j44g2000cwa.googlegroups.com>
Content-Type:   text/plain; format=flowed

ssegall ,

Aint gonna work. You are conditionally adding and taking values out of the que which SAS builds when the lag function is used. The code you posted below pulls and pushes values when ID is missing which means missing values get pulled and placed on the que, which means it aint gonna work.

Toby Dunn

Quickly, bring me a beaker of wine, so that I may wet my mind and say something clever. Aristophanes

Wise people, even though all laws were abolished, would still lead the same life. Aristophanes

You should not decide until you have heard what both have to say. Aristophanes

From: ssegall@GMAIL.COM Reply-To: ssegall@GMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Autofill empty fields Date: Tue, 5 Dec 2006 12:06:33 -0800

Am I wrong or would this also work? Data ; set ; if ID=. then ID=lag1(ID); run;

John I wrote: > webonomic wrote: > > > I cannot wrap my head around how to do this. It seems so simple of a > > problem. > > > > I have data like this: > > > > ID ProductId Year > > 1 3123 2003 > > 3456 2004 > > 3333 2003 > > 2980 2002 > > 2 3456 2004 > > 3333 2003 > > 3 2980 2002 > > 3456 2004 > > 3333 2003 > > 2980 2002 > > 4 3456 2004 > > 5 3333 2003 > > 2980 2002 > > 6 3456 2004 > > 3333 2003 > > 2980 2002 > > > > I need to reshape this dataset and autofill the ID column. So 1 should > > be repeated in the ID field until it hits the 2, at which point 2 > > should be repeated until it hits the 3 and so on. > > > > Some may not have empty fields after it, such as the 4. > > > > Thanks. > > > > Jared > > > > > > See "retain" in SAS Base documentation.

_________________________________________________________________ Get the latest Windows Live Messenger 8.1 Beta version. Join now. http://ideas.live.com


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