Hello,
I show an example of the database I have:
If you observe variables "construction associated 1" and construction associated 2" have some values separated by ;. This is not a mistake of importation, it is originally like that. I would like to create new observations separating the values of the variables "construction associated 1" and construction associated 2" by ;. I would like that these new observations maintained the same values of the rest of the variables. A more concrete example:
Imagine observation 1, which region is A, year 2006, etc. In column constructionassociated1, there are Firm A; Firm B; Firm C. I would like to split that in three observations, Firm A, Firm B and Firm C, maintaining the value of the rest of the variables, region, year, constructions, latitude, longtitude, etc. The same applies for variable "constructionassociated2".
Any idea/suggestion of how deal with it? Please, let me know if my question is not clear.
Diego.
I show an example of the database I have:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str1 region int year byte constructions str46 constructionassociated1 str30 constructionassociated2 byte typeofconstruction float(latitude longtitude) "A" 2006 1 "Firm A; Firm B; Firm C" "Firm 1; Firm 2" 3 3.45 .9 "A" 2007 2 "Firm A" "Firm 1" 4 3.56 2.3 "A" 2008 3 "Firm D" "Firm 3" 5 4.56 4.5 "A" 2009 2 "Firm H" "Firm 4" 2 5.78 6.7 "B" 2006 2 "Firm B" "Firm 2; Firm 4; Firm 7" 2 .04 5.3 "B" 2008 2 "Firm G; Firm J; Firm B" "Firm 2" 2 4.5 4 "B" 2014 3 "Firm T" "Firm 8" 1 3.2 5 "C" 2012 3 "Firm L" "Firm 2" 3 5.4 3.4 "C" 2012 4 "Firm G; Firm T; Firm A" "Firm 4; Firm 2; Firm 3; Firm 1" 6 2.2 2.3 "D" 2005 1 "Firm A" "Firm 9" 7 1.1 0 "D" 2004 1 "Firm C" "Firm 0" 7 3.4 7.8 "D" 2003 2 "Firm H; Firm L" "Firm 3" 8 6.7 1 "H" 2002 4 "Firm A; Firm B; Firm H; Firm T; Firm L; Firm Z" "Firm 5; Firm 9" 8 7 2.3 "H" 2003 5 "Firm Q" "Firm 1" 9 6 4 "H" 2006 5 "Firm W" "Firm 5; Firm 9" 3 .01 5 end
Imagine observation 1, which region is A, year 2006, etc. In column constructionassociated1, there are Firm A; Firm B; Firm C. I would like to split that in three observations, Firm A, Firm B and Firm C, maintaining the value of the rest of the variables, region, year, constructions, latitude, longtitude, etc. The same applies for variable "constructionassociated2".
Any idea/suggestion of how deal with it? Please, let me know if my question is not clear.
Diego.
Comment