%mktex(3 ** 3, n=3**3, seed=238)

proc print data=design noobs;
run;

%choiceff(data=design, model=class(x1-x3 / standorth), nsets=9, flags=3,
          seed=289, maxiter=60, options=relative, beta=zero)

proc print data=best;
   var x1-x3;
   id set;
   by set;
run;

proc print data=bestcov label;
   id __label;
   label __label = '00'x;
   var x:;
run;

%mktex(3 ** 9, n=2187, seed=368)

%mktroll(design=Design, key=3 3, out=Rolled)

%mktdups(generic, data=Rolled, factors=x1-x3, nalts=3, out=NoDups)

proc print data=NoDups(obs=9) noobs;
run;

%choiceff(data=NoDups, model=class(x1-x3 / standorth), nsets=9, nalts=3,
          maxiter=20, seed=205, options=relative, beta=zero)

proc print data=Best;
  var set _alt_ x1-x3;
run;

%mktex(4 ** 6, n=32, seed=104)

%macro res;
   do i = 1 to nalts;
      do k = i + 1 to nalts;
         if all(x[i,] >= x[k,]) then bad = bad + 1;
         if all(x[k,] >= x[i,]) then bad = bad + 1;
      end;
   end;
%mend;

%choiceff(data=randomized, model=class(x1-x6 / sta), nsets=8, flags=4,
          seed=104, options=relative, restrictions=res, resvars=x1-x6,
          maxiter=20, beta=zero)

proc format;
   value x1f 1='Bad'   2='Good'    3='Better'   4='Best';
   value x2f 1='Small' 2='Average' 3='Bigger'   4='Large';
   value x3f 1='Ugly'  2='OK'      3='Average'  4='Nice ';
   value x4f 1='Slow'  2='Fast'    3='Faster'   4='Fastest';
   value x5f 1='Rough' 2='Normal'  3='Smoother' 4='Smoothest';
   value x6f 1='$9.99' 2='$8.99'   3='$7.99'    4='$6.99';
run;
proc print data=best label;
   label x1 = 'Quality'
         x2 = 'Size'
         x3 = 'Appearance'
         x4 = 'Speed'
         x5 = 'Smoothness'
         x6 = 'Price';
   format x1 x1f. x2 x2f. x3 x3f. x4 x4f. x5 x5f. x6 x6f.;
   by set;
   id set;
   var x:;
run;

data Design;
   input Set Size Color Price ;
   datalines;
1 1 1 1 
1 2 3 2 
1 3 2 3 
2 1 3 3 
2 2 2 1 
2 3 1 2 
3 1 2 2 
3 2 1 3 
3 3 3 1 
;

%choiceff(data=Design, init=Design(keep=Set), intiter=0,
          model=class(Size Color Price / sta), nsets=3,
          nalts=3, options=relative, beta=zero)