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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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