I need to compare 5 variables' values p1 -p5 , and create a new
variable return to the largest value of p1 - p5,
Is there any simply way ( sas funtions..) to get this rather than
writing a loop compare one by one?
Your help will be much appreciated!
-Xin
|
|
0
|
|
|
|
Reply
|
Xin
|
3/2/2010 3:53:36 PM |
|
Xin, are you looking for this shown below?
data test;
input v1-v5;
cards;
1 2 3 4 5
21 11 10 22 20
;
data test1;
set test;
newvar = max(of v1 -v5);
run;
|
|
0
|
|
|
|
Reply
|
PJ
|
3/2/2010 4:17:54 PM
|
|
On Mar 2, 11:17=A0am, PJ <luxuem...@yahoo.com> wrote:
> Xin, are you looking for this shown below?
>
> data test;
> input v1-v5;
> cards;
> 1 2 3 4 5
> 21 11 10 22 20
> ;
>
> data test1;
> =A0 =A0set test;
> =A0 =A0newvar =3D max(of v1 -v5);
> run;
Yep, thank you so much!
The other function ordinal can return kth smallest value of the v1-v5,
I just found it, that make my program even more efficient!
Again, thank you very much for your help!
-Xin
|
|
0
|
|
|
|
Reply
|
Xin
|
3/2/2010 6:27:40 PM
|
|