Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float id str12 country str32 all 1 "Singapore" "SingaporeThailandSingaporeBurma" 1 "Thailand" "SingaporeThailandSingaporeBurma" 1 "Singapore" "SingaporeThailandSingaporeBurma" 1 "Burma" "SingaporeThailandSingaporeBurma" 2 "Hong Kong" "Hong KongLaoMacauSingaporeTaiwan" 2 "Lao" "Hong KongLaoMacauSingaporeTaiwan" 2 "Macau" "Hong KongLaoMacauSingaporeTaiwan" 2 "Singapore" "Hong KongLaoMacauSingaporeTaiwan" 2 "Taiwan" "Hong KongLaoMacauSingaporeTaiwan" end
Code:
bys id: gen t = _n reshape wide country, i(id) j(t) egen all2 = concat(country*) reshape long country,i (id) j(j) drop if country == "" drop j
- Any other (more concise) way to do this?
- Is it possible to put a comma between countries in `all' variable?
0 Response to gather countries together?
Post a Comment