//
//Vector variable
//
//You can declare vector variable.Vector can be defined for 1 or 2 dimension.

//Syntax for 1 dimension
vector [vectorname][size]; 

//Syntax for 2 dimension
vector [vectorname][size1][size2];
//(Caution)
//size1 must be larger than size2 (size1 >= size2).

//Remark
//In the case of vec[20], they are written in file as follows.
$vec_1,vec_2,vec_3, ..... ,vec_20
//In the case of vec[3][2],they are written in file as follows.
$vec_1,vec_2,vec_3,vec_4,vec_5,vec_6
//vec[i][j] -> vec_x  x=3*(i-1)+j;


//Example 1 reads vector data.
get haz2@;

vector tim[12];

for(i=0;i<=12;i++) {
   censor=1;
   pstime=i;
   if(i == 0) {
     default=0;
   } else {
     default=tim[i];
   }
   grade=rating;
   outrec;
}

select grade censor pstime default;

//Example 2 writes standard distribution.
clear;
vector v[4];

for(i=1;i<=100;i++) {
  for(j=1;j<=4;j++) {
      v[j]=ranstd(j,1.0);
  }
  outrec;
}

plot scat v_1 - 4 ;

//Exsam;e 3 rename value name to vector
hand   name Math Language Science Chemical Physics Geography/
Mac	56	56	49	77	66	79
Linda	72	80	87	98	95	90
Jim	74	71	70	74	66	56
Sam	76	73	68	75	71	72
Jimmy	75	73	63	78	79	74
Babara	73	71	66	60	65	79
Tom	69	69	70	79	69	60
Kevin	62	69	77	73	70	66
Lora	66	72	73	66	70	73
Rose	72	62	67	83	59	56
;

vector sub[6]=Math Language Science Chemical Physics Geography;

corr sub_1-6;