2 dimensional array in unix

I am trying to implementing two dimensinal array in ksh script.Would you pls help me out.

I have a large size of file, File contains looks like

ID SID VLAUE1 VALUE2 TOTALVALUE

1 a1 01 02 03
1 b1 02 05 07
3 c1 01 09 10
3 c1 11 09 20
.
.
.

I want to create a file or report which displays All the values by ID and SID

For example

Report By ID type

1    01 02 02 05 03 07
3    01 11 09 09 10 20

Report By SID type

a1     01 02 03

Then we can calculate minimum, maximum , avg values from the list.

---------- Post updated at 03:11 PM ---------- Previous update was at 02:57 PM ----------

#!/bin/ksh

Prev_Id=0;
i=0
file_name='$PWD/myfile'
tmp_file='$PWD/temp_file'

echo $file_name

echo $tmp_file
while read line; do

  Id=$\(echo $line|awk  '\{print $1\}'\)
  Sid=$\(echo $line|awk '\{print $2\}'\)
  Val1=$\(echo $line|awk  '\{print $3\}'\)
  Val2=$\(echo $line|awk  '\{print $4\}'\)
  Total_val=$\(echo $line|awk '\{print $5\}'\)
  \#echo $Feed_Id
  if [ $Prev_Id == $Id ];then

   \#Here I want to push the Id and all the values into an  array or hash that can hold uniq Id and all the values.        
       continue;
  fi

done<$file_name

---------- Post updated at 03:54 PM ---------- Previous update was at 03:11 PM ----------

Can anyone help me out.

how about something like:

#  awk '{t[$1]=t[$1]" "$3" "$4" "$5}END{print "Report By ID type\n";for (x in t) print x,t[x]}' infile
Report By ID type

3  01 09 10 11 09 20
1  01 02 03 02 05 07

And similarly for SID (i.e. $2)...

while(<DATA>){
  my @tmp = split;
  push @{$id{$tmp[0]}}, $tmp[2]." ".$tmp[3]." ".$tmp[4];
  push @{$sid{$tmp[1]}}, $tmp[2]." ".$tmp[3]." ".$tmp[4];
}
print "----id-----\n";
foreach my $key (keys %id){
 print $key," @{$id{$key}}\n";
}

print "------sid-----\n";
foreach my $key (keys %sid){
 print $key," @{$sid{$key}}\n";
}
__DATA__
1 a1 01 02 03
1 b1 02 05 07 
3 c1 01 09 10
3 c1 11 09 20