I have several datasets I would like to merge, however, they are set up differently.
What I have is:
HHID | Appliance | Cost | Number |
1 | Phone | 10 | 2 |
1 | TV | 150 | 1 |
1 | Fridge | 200 | 1 |
1 | Radio | 5 | 1 |
2 | TV | 140 | 1 |
2 | Light | 3 | 4 |
3 | Charger | 4 | 3 |
3 | CD Player | 5 | 1 |
3 | Freezer | 100 | 1 |
HHID | Phone | TV | Fridge | Radio | Light | Charger | CD Player | Freezer | Phone_Cost |
1 | 2 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 10 |
2 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
3 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 1 | 0 |
HHID = household ID
Appliance = name of appliance
Costs = costs of respective appliance
Number = number pf appliance available in the household
Of course, my dataset is much larger which is why I would prefer some easy code.
Thank you in advance :-)
With kind regards
Maria
0 Response to Rearrange panel data in STATA
Post a Comment