Dear All,
I got stuck with my stata work. I have data on sectors (HSspecific) and countries (reporter). I wanna create a variable indicating that it is for a given country in a given sector, so that I have for example for Australia in sector 0 : AUS0. Here is a sample of my data:
I was just trying to multiply the variables like:
gen country_sector=HSspecific*reporter
but it didn't yield the expected results. Then I tried to destring, encode etc, but wasn't successful. I've just run out of ideas and hope You could help me
I got stuck with my stata work. I have data on sectors (HSspecific) and countries (reporter). I wanna create a variable indicating that it is for a given country in a given sector, so that I have for example for Australia in sector 0 : AUS0. Here is a sample of my data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double tradevalue_ex str3 reporter long HSspecific 315057867 "AUS" 0 99401267 "AUS" 0 30544335 "AUS" 0 61603138 "AUS" 0 2635123555 "AUS" 0 132330437 "AUS" 0 5267085798 "AUS" 0 760438676 "AUS" 0 49257876 "AUS" 0 76051716 "AUS" 0 457469316 "AUS" 0 96004848 "AUS" 0 1353869319 "AUS" 0 31251833517 "AUS" 0 287704907 "AUS" 0 160930750 "AUS" 0 117388387 "AUS" 0 87805534 "AUS" 0 6158398175 "AUS" 0 30460372 "AUS" 0 52773899 "AUS" 0 69735614 "AUS" 0 3834472665 "AUS" 0 831655308 "AUS" 0 534397254 "AUS" 0 0 "AUS" 0 15356473026 "AUS" 0 248284111 "AUS" 0 27206046 "AUS" 0 1294341301 "AUS" 0 828494978 "AUS" 0 800932944 "AUS" 0 197823700 "AUS" 0 1031543916 "AUS" 0 17710695419 "AUS" 0 0 "AUS" 0 9814552469 "AUS" 0 6114960461 "AUS" 0 421347631 "AUS" 0 277438187 "AUS" 0 41767722 "AUS" 0 5431902055 "AUS" 0 129208194 "AUS" 0 7069127457 "AUS" 0 15777475 "AUS" 0 313441983 "AUS" 0 12640587 "AUS" 0 707285627 "AUS" 0 1420528572 "AUS" 0 647406302 "AUS" 0 752961734 "AUS" 0 0 "AUS" 0 704865737 "AUS" 0 41337976 "AUS" 0 557247237 "AUS" 0 74196834 "AUS" 0 1787465424 "AUS" 0 59750768 "AUS" 0 2382657934 "AUS" 0 82395005 "AUS" 0 375886871 "AUS" 0 40981612 "AUS" 0 1556555985 "AUS" 0 529222435 "AUS" 0 129210047 "AUS" 0 0 "AUS" 0 1798172822 "AUS" 0 4925112283 "AUS" 0 451818896 "AUS" 0 4415983763 "AUS" 0 666176798 "AUS" 0 224357654 "AUS" 0 303970724 "AUS" 0 89367652 "AUS" 0 5307657643 "AUS" 0 100021130 "AUS" 0 867382268 "AUS" 0 73804136765 "AUS" 0 2980450888 "AUS" 0 1029633820 "AUS" 0 2447608055 "AUS" 0 3687916642 "AUS" 0 1126056378 "AUS" 0 587539406 "AUS" 0 23610568 "AUS" 0 42009484 "AUS" 0 366882895 "AUS" 0 1429329689 "AUS" 0 7356810011 "AUS" 0 10184268115 "AUS" 0 519814575 "AUS" 0 318655944 "AUS" 0 33176840 "AUS" 0 847104126 "AUS" 0 11142131 "AUS" 0 579277761 "AUS" 0 2778133661 "AUS" 0 134253261 "AUS" 0 203037891 "AUS" 0 135200284 "AUS" 0 end
I was just trying to multiply the variables like:
gen country_sector=HSspecific*reporter
but it didn't yield the expected results. Then I tried to destring, encode etc, but wasn't successful. I've just run out of ideas and hope You could help me
Comment