SAS Macro for the Generation of a Class of Strongly Neighbour Balanced Block Designs
Authors: Arpan Bhowmik, Seema Jaggi, Eldho Varghese#, Cini Varghese, Anindita Datta and Mohd. Harun
ICAR-Indian Agricultural Statistics Research Institute, New Delhi-110012
#ICAR- Central Marine Fisheries Research Institute, Kochi- 682 018

1. Introduction

Experimentation and drawing of valid interpretation based on the experiments are considered as essential feature of any investigation of scientific nature. The scientific investigation deals with the formulation of a hypothesis as par the demand of experiments and to establish or reject the hypothesis under consideration. Postulation of hypothesis then followed by designing of the experiments considering the objectives, availability of experimental material, cost and time constraints of the experiment etc. An improper designing of experiments may either leads to the establishment of a false hypothesis or may cause the rejection of a real hypothesis. Thus, experimenters need to design the experiments carefully. While designing an experiment, the first thing which will come in the mind of an experimenter is the heterogeneity in the experimental material. Block designs are effective tools which controls the local variation over the experimental material by grouping the whole experimental material into small homogenous groups. In the conventional block designs available in the literature, response is affected by the joint effects of treatments and blocks. However, in many agricultural and allied research, apart from the block effects, the observation or response of a particular plot of a block may not only be affected by the treatment which has been applied to that plot, but also may be affected by those treatments which have been applied to the adjacent plots of that particular plots. In such scenario, one can say that, the response of a particular plot may also gets affected by the neighbour treatment effects of a particular plot. For example, in varietal trials, taller neighbouring varieties may play an important role in depressing the yields of their shorter neighbouring varieties (Kempton and Lockwood, 1984). Another common examples of neighbour effects may be the fertilizer trials where the fertilizer sprayed in a particular plot may affect neighbouring plots. Although, remote, but when considered in the model, neighbour effects can increase the precision of the results. In such scenario, instead of considering a classical block model one can consider a block model neighbour effects and the designs which can be considered for this situations will be neighbour balanced designs. A design is said to be neighbour balanced if a particular treatment have all other treatments as its left and right neighbour equal number of times. If a particular treatment also appears as its own neighbour, then the design is known as strongly neighbour balanced designs. A lot of literature is available which deals with different aspect of neighbour balanced designs [see for references Azais et al. (1993), Jaggi et al. (2007), Bhowmik et al. (2012), Bhowmik (2013), Bhowmik et al. (2013), Bhowmik et al. (2015), Bhowmik et al. (2017), Jaggi et al. (2017) etc.]. Here, we have discussed about a SAS Macro which has been developed for the purpose of generation of a strongly neighbour balanced block designs in the lines of Bhowmik et al. (2014), Varghese et al. (2017) and Bhowmik et al. (2018).

2. Experimental Setup

Let, there are v treatments applied in b number of blocks each of size k and each treatment replicated r number of times. Let the treatment applied to the ith plot of the jth block, i = 1, 2,… ,k; j = 1, 2,… ,b is denoted by d(i, j). Further, the response from the ith plot in the jth block is denoted by Y ij. Based on the above setup, following is a block model with neighbour effects from both side:


where μ is the general mean, the direct effect of treatment d(i, j) is denoted by τd(i,j). Here, δd(i-1, j) and δd(i+1, j) are the effects of treatments arising from left and right side of d(i, j), βj is the j th block effect, eij is the error term under usual assumptions. Under the model, Bhowmik et al. (2015) obtained a series of strongly neighbour balanced block designs with parameters v = b, r = k = 2v2, μ1= 2v, where μ1 indicates the number of times a particular treatment has all the treatments (including itself) as left and right neighbours in the design. Following is an example with 2 treatments:

1 1 1 2 2 1 2 2
2 1 2 2 1 1 1 2

The design with border plot at both end results in a series of strongly balanced block designs with b = 2, r = 8, k = 8 and μ1=4. For easy accessibility of end users and to provide them a readymade solution, following macro has been developed.

3. SAS macro for the generation of the design

For generation the above class of design, user only need to enter the number of treatments as v which may be any number in the real line. The number of treatment v should be a prime number. If user enter 0 or if user does not enter any number error will arise and error message will be displayed in the log window of SAS. If user, enter any number, the design will be generated and the output will be displayed in the output window of SAS. User can then easily save the output. Following is the details of the SAS macro:

/* For easy accessibility of end users, the following macro generates a strongly neighbour balanced block designs with v (Number of treatments),b (Number of Blocks) = v, r (Number of Replications per treatment)= 2v 2,k (block size)= 2v2 and μ1 (number of times treatments are appearing as neighbour)= 2v


%let v=3;

proc iml ;


do j= 1 to (2*&v);

do i=1 to &v;

a[i,j ]=i;





do k=1 to &v-1;

do j=1 to (2*&v);

do i=1 to &v;

a[i,((2*&v)*k)+j]= a[i,j]+k;

a[i,((2*&v)*k)+j+1]= a[i,j+ 1];





do j=1 to (2*&v*&v);

do i=1 to &v;

if a[i,j]>&v then a[i,j]=a[i,j]-&v;



print a [format=3.0];

SAS Output

Following is the output obtained through the macro for v=3

The SAS System

Design for v = 3
1 1 1 2 1 3 2 1 2 2 2 3 3 1 3 2 3 3
2 1 2 2 2 3 3 1 3 2 3 3 1 1 1 2 1 3
3 1 3 2 3 3 1 1 1 2 1 3 2 1 2 2 2 3

4. Conclusion

The SAS macro which has been developed, is of great use to the end users. One can generate any number of designs using the SAS macro. The designs which can be generated by the macro will be of useful to the researchers as these designs are strongly neighbour balanced, therefore they can easily tackle the problem of neighbour effects and can increase the precision of experiments.


Azais, J. M., Bailay, R. A. and Monod, H. (1993). A catalogue of efficient neighbour design with border plots. Biometrics, 49, 1252-1261.

Bhowmik, A., Jaggi, S., Varghese, C. and Varghese, E.. (2012). Block designs balanced for second order interference effects from neighbouring experimental units. Statistics and Applications, 10 (1&2), 1–12.

Bhowmik A. 2013 . Experimental designs involving treatments exhibiting interference effects . Unpublished Ph.D. Thesis, IARI, New Delhi.

Bhowmik, A., Jaggi, S., Varghese, C. and Varghese, E. (2013). Universally optimal second order neighbour designs. Model Assisted Statistics and Applications, 8, 309–314.

Bhowmik, A., Jaggi, S., Varghese, C. and Varghese, E. (2015). Optimal block designs with interference effects from neighbouring units under a non additive model. Communication in Statistics-Theory and Methods, 44, 2092-2103.

Bhowmik, A., Jaggi, S., Varghese, E. and Varghese, C. (2017). Optimal block designs with non additive mixed effects interference. Communications in Statistics - Theory and Methods. 46(24), 12103-12112.

Bhowmik, A., Varghese, E., Jaggi, S. and Varghese, C. (2014). SAS Macro for Generation of Trend Free Neighbour Balanced Block Designs. Available at

Bhowmik, A., Varghese, E., Jaggi, S. and Varghese, C. (2018). SAS Macro for Generation of Symmetric Factorial with Minimally Changed Run Sequences. Available at

Jaggi, S., C. Varghese, and V. K. Gupta. (2007). Optimal circular block designs for competition effects. Journal of Applied Statistics, 34 (5), 577–584.

Jaggi, S., Pateria, D., Varghese, C., Varghese, E. and Bhowmik, A. (2017). A note on circular neighbor balanced designs. Communication in Statistics-Simulation and Computation. DOI: 10.1080/03610918.2017.136198.

Kempton, R. A. and Lockwood, G. (1984). Inter-plot competition in variety trials of field beans (Vicia faba L.). Journal of Agricultural Sciences, Cambridge 103, 293-302.

Varghese, E., Bhowmik, A., Jaggi, S. and Varghese, C., Kaur, C. (2017). On the generation of cost effective response surface designs.

Computers and Electronics in Agriculture .

133 , 37–45.

About Author / Additional Info:
• Working as a scientist from 2012
• published around 45 research papers in national and international
journals of repute
• served as resource person in different institute
• received IARI merit medal for outstanding academic performance in
• received Dr. G.R. Seth young Scientist Award-2015 by Indian Society
of Agricultural Statistics
• Received Krishi Vigyan Gaurav (honorary title) by ARCC and BKAS
• Received International Travel Support from SERB to participate in a
conference in Costa Rica