//
//Loop control
//
//Syntax
for(initial;end condition;incliment) {
statements;
}
//
//Example
//
//Generate binominal distribution by loop control.
clear;
n=10;
//Generate 10 records by loop control.
for(i=1;i<=n;i++) {
r=i;
outrec;
}
//p=nCr*{p**r}*{(1-p)**(n-r)}
//nCr=n!/{r!*(n-r)!}
//Calcurate binominal formula on each record.
nCr=(n!)/{(r!)*(n-r)!};
pd=0.6;
pdd=(pd**r)*(1-pd)**(n-r);
p=nCr*pdd;
//Cumulative probability distribution.
accume sum;
sum=p;
//View binominal distribution
plot bar p by r;
//View cumulative probability distribution.
plot line sum by r;