%mktex(4 2 ** 4, n=8, seed=306)

proc sort data=randomized out=randes(drop=x1);
   by x2 x1;
   run;

proc print noobs data=randes;
run;

%mktbibd(b=20, nattrs=16, setsize=4, seed=104)

%mktppro(design=randes, IBD=bibd, print=f p)

%choiceff(data=chdes,                 /* candidate set of choice sets         */
          init=chdes,                 /* initial design                       */
          initvars=x1-x16,            /* factors in the initial design        */
          model=class(x1-x16 / sta),  /* model with stdz orthogonal coding    */
          nsets=80,                   /* number of choice sets                */
          nalts=2,                    /* number of alternatives               */
          rscale=                     /* relative D-efficiency scale factor   */
          %sysevalf(80 * 4 / 16),     /* 4 of 16 attrs in 80 sets vary        */
          beta=zero)                  /* assumed beta vector, Ho: b=0         */


%mktorth(options=parent, maxlev=144)

data x(keep=n design);
   set mktdeslev;
   array x[144];
   c = 0;
   one = 0;
   k = 0;
   do i = 1 to 144;
      c + (x[i] > 0);
      if x[i] > 1 then do;
         p = i;
         k = x[i];
      end;
      if x[i] = 1 then do;
         one + 1;
         s = i;
      end;
   end;
   if c = 1 then do;
      c = 2;
      one = 1;
      s = p;
      k = p - 1;
   end;
   if c = 2 and one = 1 and k > 2 and s * p = n;
   design = compbl(left(design));
   run;

proc print;
run;


%mktex(6 3 ** 6, n=18, seed=424)

proc sort data=randomized out=randes(drop=x1);
   by x2 x1;
run;

proc print data=randes noobs;
run;

%mktbsize(nattrs=20, setsize=6, options=ubd)

%mktbibd(b=10, nattrs=20, setsize=6, seed=104)

%mktppro(design=randes, IBD=bibd, print=f p)

%choiceff(data=chdes,                /* candidate set of choice sets         */
          init=chdes,                /* initial design                       */
          initvars=x1-x20,           /* factors in the initial design        */
          model=class(x1-x20 / sta), /* model with stdz orthogonal coding    */
          nsets=60,                  /* number of choice sets                */
          nalts=3,                   /* number of alternatives               */
          rscale=                    /* relative D-efficiency scale factor   */
          %sysevalf(60 * 6 / 20),    /* 6 of 20 attrs in 60 sets vary        */
          beta=zero)                 /* assumed beta vector, Ho: b=0         */