BookmarkSubscribeRSS Feed
Parashar
Calcite | Level 5
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
3 REPLIES 3
andreas_lds
Jade | Level 19
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.
deleted_user
Not applicable
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
Parashar
Calcite | Level 5
Hi Sukanya ,
Thank you very much for your support its working fine as per my req. Thanks a lot.
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1216 views
  • 0 likes
  • 3 in conversation