From: Xin on 2 Mar 2010 10:53 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
From: PJ on 2 Mar 2010 11:17 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;
From: Xin on 2 Mar 2010 13:27 On Mar 2, 11:17 am, PJ <luxuem...(a)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; > set test; > newvar = 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
|
Pages: 1 Prev: insert a decimal point Next: NESUG 2010 Call for Papers is Now Open! |