Help using Base SAS procedures

Need help in tranposing clinical data

Reply
Occasional Contributor
Posts: 5

Need help in tranposing clinical data

my raw data is like this
id ab bb cb db eb a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3
1 11 23 43 23 43 12 34 54 23 43 11 23 45 67 65 11 23 45 67 32
2 43 54 76 87 45 67 87 54 67 89 76 54 34 67 89 09 76 45 34 56

I have to make it like this
base 1wk 2wk 3wk
a 11 12 11 11
b 23 34 23 23
c 43 54 45 45
d 23 23 67 67
e 43 43 65 32



Please Help me with this and guid me how to transpose that using proc transpose or array or anything else pls give me coding for that also

Thanks in advance
Super Contributor
Posts: 345

Re: Need help in tranposing clinical data

Have a look at the online documentation, everything you need is there.

Some ideas: use a data-step to read the raw-data. In that data-step use an additional length-statement to define the four variables base and wk1-wk4. Use the output statement to create multiple records for each line read from the raw-data-file. You can shorten your code by using an array, but the problem can be solved without it.
N/A
Posts: 0

Re: Need help in tranposing clinical data

One way of acheive this by using arrays. Hope this will work.

data want(keep=id base wk1 wk2 wk3);
set have;
array base1{5} ab bb cb db eb;
array w1{5} a1 b1 c1 d1 e1;
array w2{5} a2 b2 c2 d2 e2;
array w3{5} a3 b3 c3 d3 e3;
do i=1 to 5;
base=base1{i};
wk1=w1{i};
wk2=w2{i};
wk3=w3{i};
output;
end;
run;

~ Sukanya E
Occasional Contributor
Posts: 5

Re: Need help in tranposing clinical data

Posted in reply to deleted_user
Hi Sukanya ,
Thank you very much for your support its working fine as per my req. Thanks a lot.
Ask a Question
Discussion stats
  • 3 replies
  • 87 views
  • 0 likes
  • 3 in conversation