The variable id has the purpose of identifying each individual, for example the line n°11 and 12 of the observations belong to the same individual but it is registered as two; this has caused me trouble due to the fact that I need to merge this database to another one and it cannot be done because of each id does not have unique values (they are registered as two observations)
What I´ve tried is to create as many dummy as the possible options of P803 are, however I still need to find a way to combine the observations so it appears as one unique observations, I will try to ilustrate with a table:
For example, As line 11 and 12, I have:
id | P803 |
201704007065005004064110101014402 | 7 |
201704007065005004064110101014402 | 8 |
id | P803_7 | P803_8 |
201704007065005004064110101014402 | 1 | 1 |
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str33 id byte P803 "201712007060005001002110101014401" 18 "201712007060005001023110101014401" 18 "201712007060005001023110101014402" 18 "201712007060005001035110101014401" 18 "201712007060005001046110101014402" 18 "201704007061005002009110101014401" 1 "201704007061005002071110101014403" 1 "201711007063005003001110101014402" 12 "201711007063005003053110101014401" 7 "201711007063005003070110101014401" 18 "201711007063005003140110101014402" 7 "201711007063005003140110101014402" 8 "201704007065005004025110101014401" 18 "201704007065005004064110101014402" 7 "201704007065005004064110101014402" 8 "201704007065005004160110101014401" 8 "201704007065005004160110101014402" 8 "201706007066005005042110101014402" 20 "201706007066005005114110101014401" 16 "201706007066005005114110101014402" 20 "201708007068005006016110101014402" 7 "201708007068005006016110101014402" 18 "201708007068005006046110101014401" 10 "201703007070005007007110101014403" 1 "201703007070005007036110101014401" 1 "201707007073005008004110101014402" 10 "201707007073005008004110101014402" 18 "201707007073005008058110101014401" 1 "201707007073005008058110101014403" 7 "201707007073005008058110101014404" 1 end label values P803 P803 label def P803 1 "Clubes y asociaciones deportivas", modify label def P803 7 "Asociación profesional", modify label def P803 8 "Asociación de trabajadores o sindicato", modify label def P803 10 "Asociación de padres de familia (APAFA)", modify label def P803 12 "Comedor popular", modify label def P803 16 "Comunidad campesina", modify label def P803 18 "Otro/a", modify label def P803 20 "Participación en la preparación de desayuno y/o almuerzo escolar", modify
I really appreciate any response and possible solution in advance.
I using Stata 13/MP/64.
0 Response to Combining observations into one
Post a Comment