Dear all,

I'm dealing with some data from a conjoint experiment. Currently, it is in wide format (each row an individual), and I'd like to get it into long format. Here is some dummy data from the current wide format:

Code:
clear
input id    govA_c1_1    govA_c1_2    govB_c1_1    govB_c1_2    choice_1    choice_2
1    1    2    1    2    1    2
2    2    1    2    1    2    1
3    2    2    1    1    2    1
4    2    1    2    1    1    2
end
To explain, respondents were given the task of choosing between two governments (gov) with a set of characteristics, here reduced to just one with two values (c1). They had to make this decision twice. Thus, govA_c1_1 notes the characteristic value for government A in the first round, govA_c1_2 the second round, etc. The choice columns indicate which government (1 or 2) they chose.

I'd like to get this into a format such that each row identifies each contest/government/respondent combination. The row 'c1' shows characteristic 1 value for governments 1/2 at each contest. Choice indicates whether respondent chose that government in that contest.

Code:
clear
input id    contest no.    c1    choice
1    1    1    1
1    1    1    0
1    2    2    0
1    2    2    1
2    1    2    0
2    1    1    1
2    2    2    0
2    2    1    1
end
Right now, I can't seem to do this correctly; either getting an error or some nonsensical format. I would guess I'm missing an intermediary step or omitting something from the command.

I hope this makes sense and I haven't made a mistake up to this point.

Thanks!