Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Discrete Choice Experiment Partial Profil Design with varying number o...

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 04-04-2020 04:40 PM
(934 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you very much, this worked perfectly for my problem.

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.