BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
eifelracerpat
Calcite | Level 5

Hi all,

I am trying to create a Discrete Choice Experiment with a Partial Profile Design from 16 Attributes. 6 with two levels and 10 with 3 levels. I successfully created a design with either all two level or all three level attributes using the Instructions provided by Kuhfeld 2010, by first creating a BIBD (or unbalanced block design) and then an orthogonal Array to build the partial profile design. But it doesn’t seem to be possible to have attributes with different numbers of levels. Does anyone know how or wether this is possible with SAS?

Thanks

 

Attached find the working code for 16 three level attributes:

%mktbibd(b=8, nattrs=16, setsize=6, seed=17) /*create BIBD */
%mktex(18 3 ** 6, n=54, seed=306) /* create orthogonal Array with one 18 level (dropped later) and six (=<setsize) 3 level */
proc sort data=randomized out=randes(drop=x1);
by x2 x1;
run;
proc print noobs data=randes; run;
%mktppro(design=randes, ibd=bibd) /* create partial profile design */

%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=144, /* number of choice sets */
nalts=3, /* number of alternatives */
rscale= /* relative D-efficiency scale factor */
%sysevalf(144 * 6 / 16), /* 6 of 16 attrs in 144 sets vary */
beta=zero) /* assumed beta vector, Ho: b=0 */

%mktblock(data=chdes, /* input choice design to block */
out=finalBlock, /* output blocked choice design */
/* stored in permanent SAS data set */
nalts=3, /* three alternatives */
nblocks=12, /* twelve blocks */
factors=x1-x16, /* 16 attributes, x1-x16 */
print=design, /* print the blocked design (only) */
seed=472) /* random number seed */
1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13

Sorry for the late response, but I am retired, so I don't pay as much attention to SAS Communities as I did when I was employed. Here is a minor variation of the example starting on page 604. I added a 4 and 5-level factor. The rest are 3-levels.

 

title ’Partial Profiles’;

%macro partprof;
sum = 0;
do k = 1 to 10;
sum = sum + (x[k] = x[k+10] & x[k] = x[k+20]);
end;
bad = abs(sum - 4);
%mend;

%mktex(3 4 5 3 ** 7 3 4 5 3 ** 7 3 4 5 3 ** 7 ,
n=200, /* 200 runs */
options=quickr /* very quick run with random init */
noqc
nox, /* suppress x1, x2, ... creation */
order=random, /* loop over columns in a random order */
out=cand, /* output design stored permanently */
restrictions=partprof, /* name of restrictions macro */
seed=382) /* random number seed */

%mktkey(3 10)

%mktroll(design=cand, key=key, out=rolled)

%mktdups(generic, data=rolled, out=nodups, factors=x1-x10, nalts=3)
proc print data=nodups(obs=9); id set; by set; run;

%choiceff(data=nodups, /* candidate set of choice sets */
model=class(x1-x10 / sta),/* model with stdzd orthogonal coding */
seed=448, /* random number seed */
maxiter=10, /* maximum iterations for each phase */
nsets=27, /* number of choice sets */
nalts=3, /* number of alternatives */
options=nodups /* no duplicate choice sets */
relative, /* display relative D-efficiency */
beta=zero) /* assumed beta vector, Ho: b=0 */

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

 

View solution in original post

4 REPLIES 4
WarrenKuhfeld
Ammonite | Level 13

Kuhfeld (2010) has lots of examples. Some show how to use combinatorial methods--orthogonal arrays and BIBDs-- to make *optimal* designs. Others show how to use computerized searches and restrictions to create the more complicated and gnarley designs researcher need in practice.

eifelracerpat
Calcite | Level 5

Dear Mr. Kuhfeld thank you very much for your reply. I am terribly sorry to bother you again with this, but I cant seem to find a solution with the given literature.

If you could just provide me with the means to create a partial profile design where some attributes have x levels and some have y levels with x<y that would already help me solve my problem.

WarrenKuhfeld
Ammonite | Level 13

Sorry for the late response, but I am retired, so I don't pay as much attention to SAS Communities as I did when I was employed. Here is a minor variation of the example starting on page 604. I added a 4 and 5-level factor. The rest are 3-levels.

 

title ’Partial Profiles’;

%macro partprof;
sum = 0;
do k = 1 to 10;
sum = sum + (x[k] = x[k+10] & x[k] = x[k+20]);
end;
bad = abs(sum - 4);
%mend;

%mktex(3 4 5 3 ** 7 3 4 5 3 ** 7 3 4 5 3 ** 7 ,
n=200, /* 200 runs */
options=quickr /* very quick run with random init */
noqc
nox, /* suppress x1, x2, ... creation */
order=random, /* loop over columns in a random order */
out=cand, /* output design stored permanently */
restrictions=partprof, /* name of restrictions macro */
seed=382) /* random number seed */

%mktkey(3 10)

%mktroll(design=cand, key=key, out=rolled)

%mktdups(generic, data=rolled, out=nodups, factors=x1-x10, nalts=3)
proc print data=nodups(obs=9); id set; by set; run;

%choiceff(data=nodups, /* candidate set of choice sets */
model=class(x1-x10 / sta),/* model with stdzd orthogonal coding */
seed=448, /* random number seed */
maxiter=10, /* maximum iterations for each phase */
nsets=27, /* number of choice sets */
nalts=3, /* number of alternatives */
options=nodups /* no duplicate choice sets */
relative, /* display relative D-efficiency */
beta=zero) /* assumed beta vector, Ho: b=0 */

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

 

eifelracerpat
Calcite | Level 5
Thank you very much, this worked perfectly for my problem.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1125 views
  • 4 likes
  • 2 in conversation