|
On Mon, 21 Jan 2008 12:53:13 +0100, Stefan Pohl <stefan.pohl@ISH.DE> wrote:
>Hi SAS-group,
>
>I want to know which is the largest value in the following matrix
>
>id var1 var2 var3 var4
>1 0 1 2 1
>2 1 0 5 4
>3 2 5 0 3
>4 1 4 3 0
>
>the matrix is symmetric
>
>How can I do this?
>
>Thank you for any help.
>
>Stefan.
data matrix;
input
id var1 var2 var3 var4 ; cards;
1 0 1 2 1
2 1 0 5 4
3 2 5 0 3
4 1 4 3 0
;
A couple of ways to do it with PROCs ...
A single SQL statement, but the columns have to be explicitly listed:
proc sql;
select max ( max( var1,var2,var3,var4 ) ) from matrix;
quit;
Two steps:
data halfbaked / view=halfbaked;
set matrix;
maxacross = max ( of var : );
run;
proc means data=halfbaked max;
var maxacross;
run;
|