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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.