Hi every one:)
I have a dataset, with variable v1 v2 and Rev, see below:
V1 | V2 | Rev |
0.01 | 0.01 | 453 |
0.01 | 0.02 | 564 |
0.01 | 0.03 | 2354 |
0.02 | 0.01 | 754 |
0.02 | 0.02 | 3534 |
0.02 | 0.03 | 1213 |
0.03 | 0.01 | 435 |
0.03 | 0.02 | 23 |
0.03 | 0.03 | 543 |
now I would like to transfer dataset into an array:
v2 | |||
v1 | 0.01 | 0.02 | 0.03 |
0.01 | 453 | 564 | 2354 |
0.02 | 754 | 3534 | 1213 |
0.03 | 435 | 23 | 543 |
How could i accomplish that? should I use array? is there any procedure better than array?
Great Thanks,
Jenny
Not sure what you mean by an array. You could use PROC TRANSPOSE, but then the numbers that you have in V2 will be turned into variable names.
proc transpose data=have out=want ;
by v1 ;
id v2 ;
var rev ;
run;
Not sure what you mean by an array. You could use PROC TRANSPOSE, but then the numbers that you have in V2 will be turned into variable names.
proc transpose data=have out=want ;
by v1 ;
id v2 ;
var rev ;
run;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.