I'm reaching out with what I would guess is a question whose answer is very simple, but I've been as yet unable to find a clear answer in reviewing the forum and available resources.
I have panel data in two waves. In each wave, the relevant variable is fruit - ie fruit at time 1 (fruit_1) and fruit a time 2 (fruit_2)
The fruit variable has only three response alternatives: apple, orange and grape. There are also fairly substantial missing data.
So the possible outcomes are a matrix of (1) apple to apple , (2) apple to orange, (3) apple to grape, (4) orange to orange.....etc.
Simply subtracting one variable from the other will not do as there would be several (distinct) outcomes for the same integer (apple to apple would be the same as orange to orange, etc).
Simply, what I'm hoping to generate is a single variable with a unique value for each possible combination of outcomes. I'm happy to provide more information to clarify if need be- thanks very much in advance for any feedback folk are able to provide.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id_1 byte(fruit_1 fruit_2) 712 2 .i 714 3 2 717 .i .i 718 2 2 721 2 2 722 .i .i 724 2 .i 729 2 .i 737 2 2 738 2 .d 739 1 2 740 1 1 741 2 2 742 2 .i 743 .i .i 744 .i .i 745 2 2 746 2 2 747 .i .i 750 2 1 751 3 2 752 1 2 753 2 2 756 2 2 757 2 .i 758 .i .i 759 .i .i 760 .i .i 761 2 2 763 .i .i end label values id_1 LABB label values fruit_1 LABIE label values fruit_2 LABIE label def LABIE 1 "apple", modify label def LABIE 2 "orange", modify label def LABIE 3 "grape", modify label def LABIE .i "IAP", modify label def LABIE .d "DK", modify
0 Response to Generating Single Change Variable In Panel Data
Post a Comment