Hello Everyone,

I am using a large survey (non panel) data set and would like to restructure multiple policy position values into one new pooled policy variable while keeping each value separate (not adding the values together). This would mean adding observations, duplicating and keeping constant all other information for each respondent as shown below:

Original Data Example:

ID__Policy1__Policy2__Policy3__X1__X2__X3

1_____A______B______C______1___2___3

2_____B______A______C______3___2___1

Where ID is the respondent's ID, Policy1/2/3 are the different values of policy positions, X1/2/3 are other variables of interest.


Restructured to:

ID__Policy__X1__X2__X3

1____A_____1___2___3

1____B_____1___2___3

1____C_____1___2___3

2____B_____3___2___1

2____A_____3___2___1

2____C_____3___2___1

Where ID is the respondent's ID, Policy is the new singular pooled policy value variable, X1/2/3 are other variables of interest.


I have not used Stata to do this before and I am sure that it is a simple solution, and I am reaching out for advice on what code is needed and any other information that you think I should be aware of.

Thanks in advance!