Prev: Single Hurdle Poisson - MCMC Procedure
Next: Duplicates
From: Al on 11 Mar 2010 15:53 ALL: I have a dataset in the following format pat lb vis res 1 c1 1 1c1 1 c1 2 B 1 c1 3 C 1 c1 4 D 1 c2 1 1c2 1 c2 2 B 1 c2 3 C 1 c2 4 D 2 c1 1 2c1 2 c1 2 B 2 c1 3 C 2 c1 4 D 2 c2 1 2c2 2 c2 2 B 2 c2 3 C 2 c2 4 D I am trying to retain values(where vis = 1 ) by pat and by lb .. The output should look like below pat lb vis res X 1 c1 1 1c1 1c1 1 c1 2 B 1c1 1 c1 3 C 1c1 1 c1 4 D 1c1 1 c2 1 1c2 1c2 1 c2 2 B 1c2 1 c2 3 C 1c2 1 c2 4 D 1c2 2 c1 1 2c1 2c1 2 c1 2 B 2c1 2 c1 3 C 2c1 2 c1 4 D 2c1 2 c2 1 2c2 2c2 2 c2 2 B 2c2 2 c2 3 C 2c2 2 c2 4 D 2c2 Any help would be appreciated Thanks in advance
From: Tom Abernathy on 11 Mar 2010 18:34 data new; set old; by pat lb vis; retain X; if vis=1 then X=res; run; You may need to add extra logic to clear X if VIS=1 is not the first record for each PAT or PAT/LB combination. On Mar 11, 3:53 pm, Al <ali6...(a)gmail.com> wrote: > ALL: > > I have a dataset in the following format > > pat lb vis res > 1 c1 1 1c1 > 1 c1 2 B > 1 c1 3 C > 1 c1 4 D > > 1 c2 1 1c2 > 1 c2 2 B > 1 c2 3 C > 1 c2 4 D > > 2 c1 1 2c1 > 2 c1 2 B > 2 c1 3 C > 2 c1 4 D > > 2 c2 1 2c2 > 2 c2 2 B > 2 c2 3 C > 2 c2 4 D > > I am trying to retain values(where vis = 1 ) by pat and by lb .. The > output should look like below > > pat lb vis res X > 1 c1 1 1c1 1c1 > 1 c1 2 B 1c1 > 1 c1 3 C 1c1 > 1 c1 4 D 1c1 > > 1 c2 1 1c2 1c2 > 1 c2 2 B 1c2 > 1 c2 3 C 1c2 > 1 c2 4 D 1c2 > > 2 c1 1 2c1 2c1 > 2 c1 2 B 2c1 > 2 c1 3 C 2c1 > 2 c1 4 D 2c1 > > 2 c2 1 2c2 2c2 > 2 c2 2 B 2c2 > 2 c2 3 C 2c2 > 2 c2 4 D 2c2 > > Any help would be appreciated > > Thanks in advance
|
Pages: 1 Prev: Single Hurdle Poisson - MCMC Procedure Next: Duplicates |