BookmarkSubscribeRSS Feed
ssas
Calcite | Level 5
Hi I am struck at this bit, could anyone guide me to how I can sortout
I have data like this
pc0809 v0809 p0910 v0910 p1011 v1011
a1 5 a4 23 a1 12
a7 45 a5 21 b1 32
a3 36 c4 41 a3 52
b1 28 a3 35 d2 20
a4 52 d2 62 y4 43
a5 32 e1 21 gg2 21

p members and their respective values in v

required output :
v20089 v0910 v1011
a1 5 - 12
a7 45 - -
a3 36 35 52
a4 52 23 -
b1 28 - 32
d2 - 62 20
e1 - 21 -

I have done
1. sort the data on P's
2. Proc tabulte
I am getting error values..
If anyone can guide me

Thanks in advance Message was edited by: ssas
1 REPLY 1
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Ssas,

This could be a possible solution to our problem:
[pre]
data a;
input p1 $ 1-2 v1 4-5 p2 $ 7-8 v2 10-11 p3 $ 13-14 v3 16-17;
datalines;
a1 5 a4 23 a1 12
a7 45 a5 21 b1 32
a3 36 c4 41 a3 52
b1 28 a3 35 d2 20
a4 52 d2 62 y4 43
a5 32 e1 21 g2 21
;
run;
data b;
set a(in=a1 keep=p1 v1 rename=(p1=p v1=v))
a(in=a2 keep=p2 v2 rename=(p2=p v2=v))
a(in=a3 keep=p3 v3 rename=(p3=p v3=v));
if a1 then var=1;
if a2 then var=2;
if a3 then var=3;
run;
proc sort data=b;
by p;
run;
proc transpose data=b out=r prefix=v;
var v;
id var;
by p;
run;
[/pre]
Sincerely,
SPR

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
  • 1 reply
  • 679 views
  • 0 likes
  • 2 in conversation