BookmarkSubscribeRSS Feed
Linh1
Calcite | Level 5

I'm preparing my data to run proc MDC but kept receiving the error: "ERROR: The NCHOICE= option is not allowed when the number of choices for each individual (ID) is not the same." I don't really get what it means. Could you help me figure out what's wrong?

 

The original dataset (final1) is a panel transaction data that has the columns: customerid, week, brand, p1 p2 p3 p4 d1 d2 d3 d4 f1 f2 f3 f4.

(P1-P4 are average price of brand 1-4 in that week, respectively. D1-4 are dummy variables showing whether that brand  is displayed in store, f1-4 are dummy variables that show whether brand 1-4 are featured in the store ads)

 

I used this code to prepare the data and the outcome is in the attached file:

 

data mergemnl(keep=pid decision mode c1 c2 c3 p d f);
set final1;
array pvec{4} p1 p2 p3 p4;
array dvec{4} d1 d2 d3 d4;
array fvec{4} f1 f2 f3 f4; 
array s1{4}(1 0 0 0);
array s2{4}(0 1 0 0);
array s3{4}(0 0 1 0);

retain pid 0;
pid + 1;
do i = 1 to 4;
mode = i;
p = pvec{i};
d = dvec{i};
f = fvec{i};
c1 = s1{i};
c2 = s2{i};
c3 = s3{i};
decision = ( brandnum = i );
output;
end;
run;

 

This is the code I used to run mdc:


proc mdc data=mergemnl;
model decision =c1 c2 c3 p d f /
type=clogit
nchoice = 4
optmethod=qn
covest=hess;
id pid;
run;

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

Message was moved to procedure thread and title shortened.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 328 views
  • 0 likes
  • 2 in conversation