* do-file for Supplementary Exercise 3.40 of IPS7e, * showing code for the third method described in the solution version 15 /* works also with versions 13-14 */ import delimited "R:\Chapter 3\ex03_040.csv" sort excw egen block=seq(), from(1) to (5) block(4) set seed 140906 gen random=uniform() sort block random egen tx=seq(), from(1) to (4) label define txgroup 1 "A" 2 "B" 3 "C" 4 "D" label values tx txgroup list, sepby(block)