Prev: Finding Predcied values with confidence level based on the regression model
Next: Jim and MMMMIIIIKKKKEEEE
From: laika on 9 Mar 2010 04:43 Hallo, I can't find a sloution for my following problem. With the next dataset : ID Name Number 1 Obj 1025 1 Res 158 1 Num 1458 2 Obj 587 2 Res 21 3 Obj 900 3 Num 28 i want to create the following dataset : ID Obj Res Num 1 1025 158 1458 2 1458 21 . 3 900 . 28 Is this possible? The Proc TRANSPOSE give me only the name of the columns. Tx
From: barryd on 9 Mar 2010 05:02 On Mar 9, 9:43 am, laika <michel.verhe...(a)axa.be> wrote: > Hallo, > > I can't find a sloution for my following problem. > With the next dataset : > > ID Name Number > 1 Obj 1025 > 1 Res 158 > 1 Num 1458 > 2 Obj 587 > 2 Res 21 > 3 Obj 900 > 3 Num 28 > > i want to create the following dataset : > > ID Obj Res Num > 1 1025 158 1458 > 2 1458 21 . > 3 900 . 28 > > Is this possible? The Proc TRANSPOSE give me only the name of the > columns. > > Tx Laika, PROC TRANSPOSE seems ideal for this. When I ran the code: proc transpose data=a out=b; by id; id name; run; In this code your input dataset is a and the dataset you require is b. I got exactly what you wanted - unless I've mis-understood your requirement. Perhaps you just missed out the ID statement. In any event I hope this helps. Regards, BPD
From: ravipoddar.bit on 9 Mar 2010 06:57
On Mar 9, 2:43 pm, laika <michel.verhe...(a)axa.be> wrote: > Hallo, > > I can't find a sloution for my following problem. > With the next dataset : > > ID Name Number > 1 Obj 1025 > 1 Res 158 > 1 Num 1458 > 2 Obj 587 > 2 Res 21 > 3 Obj 900 > 3 Num 28 > > i want to create the following dataset : > > ID Obj Res Num > 1 1025 158 1458 > 2 1458 21 . > 3 900 . 28 > > Is this possible? The Proc TRANSPOSE give me only the name of the > columns. > > Tx This query will give u the desired output: proc sql; create table x as select coalesce(p.id,z.id) as id, obj,res,numb from (select coalesce(x.id,y.id) as id, obj,res from (select id , number as Obj from a where name = 'Obj') as x full outer join (select id , number as Res from a where name = 'Res') as y on (x.id = y.id) ) as p full outer join (select id , number as numb from a where name = 'Num') as z on (p.id = z.id) order by id; quit; |