Hi Dear Profs and Colleagues,
I am going to obtain the number of immigrants in firm i, year t, sector s, and region r. What I seek is to know how many immigrant (nacio~=PT) exist in firm i sector s and region r.
firms ID: NPC_FIC
Nationalities: nacio for immigrants I consider nacio~="PT"
Any assistance is appreciated.
Cheers,
Paris
I am going to obtain the number of immigrants in firm i, year t, sector s, and region r. What I seek is to know how many immigrant (nacio~=PT) exist in firm i sector s and region r.
firms ID: NPC_FIC
Nationalities: nacio for immigrants I consider nacio~="PT"
Code:
* Example generated by -dataex-. For more info, type help dataex clear input double(NPC_FIC year) float(sector region) str2 nacio 500979142 2010 3 1 "PT" 500979162 2010 7 1 "PT" 500979168 2010 3 0 "PT" 500979172 2010 3 0 "PT" 500979182 2010 3 0 "PT" 500979184 2010 7 1 "PT" 500979206 2010 7 4 "PT" 500979220 2010 7 1 "PT" 500979239 2010 3 1 "PT" 500979255 2010 3 3 "PT" 500979261 2010 3 0 "PT" 500979266 2010 3 1 "PT" 500979269 2010 3 3 "PT" 500979271 2010 7 1 "PT" 500979383 2010 3 1 "PT" 500979456 2010 3 1 "PT" 500979474 2010 3 3 "PT" 500979489 2010 7 1 "PT" 500979491 2010 3 1 "PT" 500979522 2010 3 1 "PT" 500979526 2010 3 3 "PT" 500979530 2010 3 5 "PT" 500979532 2010 3 5 "PT" 500979537 2010 3 3 "PT" 500979543 2010 3 5 "PT" 500979551 2010 3 3 "PT" 500979561 2010 3 1 "PT" 500979563 2010 3 3 "PT" 500979564 2010 3 1 "PT" 500979566 2010 3 4 "PT" 500979567 2010 3 1 "PT" 500979569 2010 3 3 "PT" 500979596 2010 3 3 "PT" 500979634 2010 7 4 "PT" 500979705 2010 7 0 "PT" 500979725 2010 3 0 "PT" 500979737 2010 7 4 "PT" 500979740 2010 3 3 "PT" 500979750 2010 3 3 "PT" 500979758 2010 3 3 "PT" 500979797 2010 3 0 "PT" 500979809 2010 7 1 "PT" 500979820 2010 7 3 "PT" 500979825 2010 3 3 "PT" 500979874 2010 7 4 "PT" 500979890 2010 3 4 "PT" 500979959 2010 7 4 "PT" 500979964 2010 9 4 "PT" 500979983 2010 7 0 "PT" 500979987 2010 3 1 "PT" 500980019 2010 6 0 "PT" 500980048 2010 3 1 "PT" 500980053 2010 3 1 "PT" 500980104 2010 7 1 "PT" 500980110 2010 7 4 "PT" 500980138 2010 7 1 "PT" 500980167 2010 3 1 "PT" 500980175 2010 3 3 "PT" 500980231 2010 6 1 "PT" 500980233 2010 3 0 "PT" 500980243 2010 3 3 "PT" 500980247 2010 7 1 "PT" 500980265 2010 3 4 "PT" 500980319 2010 3 3 "PT" 500980385 2010 7 1 "PT" 500980401 2010 3 1 "PT" 500980402 2010 3 4 "PT" 500980415 2010 7 4 "PT" 500980421 2010 7 1 "PT" 500980485 2010 7 3 "PT" 500980507 2010 7 0 "PT" 500980532 2010 3 1 "PT" 500980598 2010 3 5 "PT" 500980626 2010 3 1 "PT" 500980638 2010 6 0 "PT" 500980722 2010 7 0 "PT" 500980854 2010 11 0 "PT" 500980855 2010 7 0 "PT" 500980873 2010 7 3 "PT" 500980898 2010 8 1 "PT" 500980903 2010 7 4 "PT" 500980907 2010 3 3 "PT" 500980935 2010 3 4 "UA" 500980936 2010 3 3 "PT" 500980938 2010 3 3 "PT" 500980947 2010 7 4 "PT" 500980992 2010 3 3 "PT" 500981007 2010 7 0 "PT" 500981020 2010 3 3 "PT" 500981066 2010 3 1 "PT" 500981084 2010 7 0 "PT" 500981094 2010 3 1 "PT" 500981140 2010 2 3 "PT" 500981156 2010 3 0 "PT" 500981164 2010 7 1 "PT" 500981265 2010 8 4 "PT" 500981281 2010 7 1 "PT" 500981292 2010 7 0 "PT" 500981317 2010 7 0 "PT" 500981318 2010 7 1 "PT" end by NPC_FIC year (sector region) ,sort: gen n_imm = sum(nacio ~= "PT") this gives values 1 and 0.
Cheers,
Paris

Comment