//
//accume variable declare // //This command is used to retain value in order to summary. //Syntax accume [variable]; //Example 1 is summation by each record by accume declare. hand hight/ 171.6 173.6 167.6 169.1 183.0 173.7 168.3 169.9 182.3 166.0 172.8 184.1 158.9 168.1 168.5 175.3 179.6 170.7 173.1 173.6 169.1 167.9 177.8 171.8 178.1 ;
//Declare accume variable accume sum; //Assign accumed varialbe and summate by each record. sum=hight;
//Get average of 'hight' by extracting last record. if(# == LAST) { average = sum/LAST; outrec; }
//Example 2 is used to calcurate moving average. //Generate 1000 record which included normal random. clear; for(i=1;i<=1000;i++) { x=ranstd(0,10); outrec; } //View histgram of 1000 normal random. plot hist x;
//Accume normal rand. accume xsum; xsum=x; //Get moving average by division of each line number. xave=xsum/#; //View moving average which converges to Zero. plot line xave;