Date: Wed, 2 Nov 2011 15:36:50 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: quick ata step
In-Reply-To: <612C0519415644EFB85A1B5B36BBF861@D1871RB1>
Content-Type: text/plain; charset=ISO-8859-1
It looks like ID should be considered. Should you reset X at first
dot ID for the situation where there is no WK=0?
On Wed, Nov 2, 2011 at 3:29 PM, Nat Wooding <nathani@verizon.net> wrote:
> Try the following.
> Nat Wooding
>
> Data one;
> input Id wk x ;
> cards;
> 01 0 3
> 01 1 4
> 01 2 .
> 01 3 3
> 01 4 .
> 02 0 8
> 02 1 1
> 02 2 7
> ;
> Data Two ;
> set one;
> retain x0;
> if wk = 0 then x0 = x;
> run;
>
> ;
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of hua
> gang
> Sent: Wednesday, November 02, 2011 1:11 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: quick ata step
>
> For following data (id, wk, x), I wanted to create a new variable, X0 that
> has value of x at wk=0,
> in other words,in this case, x=3 at wk=0, so my new var., x0 should = 3 for
> all weeks.
>
> Thanks for your help--Hua
>
> Id wk x x0
> 01 0 3 3
> 01 1 4 3
> 01 2 . 3
> 01 3 3 3
> 01 4 . 3
>
|