Hello Stata people;
I do have this data at hand:
This dataset is about the taxes that firms paid, by year and by activity sector.
The first variable is the activity sector, the second variable is the specific activity of the firm, the third variable is the number of firms in the specific activity sector that are active and did pay taxes, the fourth variable is the year (here, it is either 2022 or 2023), the fifth variable is the Local Turnover without taxes, the sixth variable is the Exportation Turnover, the seventh variable is the Total Turnover with Taxes, the eigth variable is the Taxes to pay, the ninth is the total fiscal benefit, and the last variable is the total taxable benefit.
My goal here is to have the number of firms by the activity sector (the first variable), for each year. I've tried to use the "Total" command, but I guess it didn't work. I just want the result to be displayed on Stata, not to create a new variable. The goal is to sum up the "the number of firms in the specific activity sector" (third variable) by year (the fourth variable) and by activity sector (first variable).
Any help please?
With thanks!
I do have this data at hand:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str52 Secteur_dactivité str59 Activité int(Nombre_dentreprises_par_Activité Exercice_IS_Anneé) double(Chiffre_Affaires_Local_HT Chiffre_Affaires_Exportation Chiffre_Affaires_Total_TTC Impôt_dû_Total Total_Bénéfice_Fiscal Total_Bénéfice_Imposable) "01 ACTIVITES ARTISANALES" "1001 ARTISAN EN OR" 65 2022 57043174246 4106447796 61318378837 424520200 4222126826 4172107421 "01 ACTIVITES ARTISANALES" "1001 ARTISAN EN OR" 63 2023 60773769171 3961651357 64885096609 550607478 5382228626 5375972505 "01 ACTIVITES ARTISANALES" "1002 ARTISAN EN ARGENT" 27 2022 2880454272 3223633435 6246415091 37682347 277516699 274888999 "01 ACTIVITES ARTISANALES" "1002 ARTISAN EN ARGENT" 24 2023 3478575064 3564436300 7278569761 61118900 469421988 469421988 "01 ACTIVITES ARTISANALES" "1003 ARTISAN DES METIERS DE TISSAGE" 75 2022 7703572229 7512293962 15942380219 211921756 1951646133 1870111494 "01 ACTIVITES ARTISANALES" "1003 ARTISAN DES METIERS DE TISSAGE" 71 2023 10837446061 7744248779 19756052048 220171950 2079220556 1958321469 "01 ACTIVITES ARTISANALES" "1004 ARTISAN DANS L'HABILLEMENT" 71 2022 7272236390 3400067966 11268356913 129525189 991931653 961869287 "01 ACTIVITES ARTISANALES" "1004 ARTISAN DANS L'HABILLEMENT" 65 2023 7560216240 3696418860 12046688271 144652825 1122729849 1072675103 "01 ACTIVITES ARTISANALES" "1005 ARTISAN EN CUIR , CHAUSSURE" 26 2022 1849885585 821733574 2822021530 28407500 194812444 194811444 "01 ACTIVITES ARTISANALES" "1005 ARTISAN EN CUIR , CHAUSSURE" 20 2023 2206460384 890038809 3285351766 43306422 344710630 344710630 "01 ACTIVITES ARTISANALES" "1006 ARTISAN DES METIERS DU BOIS" 95 2022 11683864892 36809596069 50042595673 230649393 2074130203 1794284291 "01 ACTIVITES ARTISANALES" "1006 ARTISAN DES METIERS DU BOIS" 87 2023 7760460445 31632734228 39975670980 246508206 2631660142 2151606463 "01 ACTIVITES ARTISANALES" "1007 ART DES PDS D'ARGILE,PIERRE" 105 2022 12628248935 9854395547 23531115634 257384556 2266356005 2250128617 "01 ACTIVITES ARTISANALES" "1007 ART DES PDS D'ARGILE,PIERRE" 97 2023 14483459590 13205233357 28918227185 311713491 2768184141 2749977821 "01 ACTIVITES ARTISANALES" "1008 ART METIERS D'IMPRESSION,ASSIMILEE." 3 2022 8307000 791338000 800767520 29900550 195837453 195837453 "01 ACTIVITES ARTISANALES" "1008 ART METIERS D'IMPRESSION,ASSIMILEE." 1 2023 0 0 0 300000 0 0 "01 ACTIVITES ARTISANALES" "1009 ART METIERS CUIVRE, ZINC,PLOMB" 21 2022 3402450388 0 3686556473 68930871 572523618 572523618 "01 ACTIVITES ARTISANALES" "1009 ART METIERS CUIVRE, ZINC,PLOMB" 20 2023 3382910980 0 3709224780 53733813 446924806 446924806 "01 ACTIVITES ARTISANALES" "1010 ART METIERS DU FER FORGE" 8 2022 1719653739 0 1855392793 9530100 123541429 86215091 "01 ACTIVITES ARTISANALES" "1010 ART METIERS DU FER FORGE" 8 2023 1094625840 0 1192484633 15677950 129404493 124482305 "01 ACTIVITES ARTISANALES" "1011 ART METIERS FIB.VEGETALES" 10 2022 2046372374 144483577 2333450867 50366026 493831954 483928011 "01 ACTIVITES ARTISANALES" "1011 ART METIERS FIB.VEGETALES" 11 2023 1654532498 131172000 1908707946 11322190 105076404 86505369 "01 ACTIVITES ARTISANALES" "1012 PEINTURE,DECORAT.TOUS SUPPORTS" 55 2022 4953281078 1512063754 6921967160 44847408 301628681 291850832 "01 ACTIVITES ARTISANALES" "1012 PEINTURE,DECORAT.TOUS SUPPORTS" 56 2023 3777443131 1917454008 5961640345 51156148 317054675 361348579 "01 ACTIVITES ARTISANALES" "1013 ART DANS LES METIERS DU VERRE" 7 2022 1751779017 0 1890213068 15162763 139521153 139521153 "01 ACTIVITES ARTISANALES" "1013 ART DANS LES METIERS DU VERRE" 8 2023 1633115182 0 1752771185 14296220 124621242 124621242 "01 ACTIVITES ARTISANALES" "1014 ART DES METIERS ALIMENTAIRES" 52 2022 38922051810 3113686837 44878769719 192312990 1211310588 1198225351 "01 ACTIVITES ARTISANALES" "1014 ART DES METIERS ALIMENTAIRES" 57 2023 42475273700 4926705695 50508977473 198225675 1210877923 1125661028 "01 ACTIVITES ARTISANALES" "1015 ART METIERS DE PREST. SERVICES" 13 2022 2463033019 2696157324 5351558492 55184400 482713459 482713459 "01 ACTIVITES ARTISANALES" "1015 ART METIERS DE PREST. SERVICES" 10 2023 2156588272 2017561821 4324341538 49960750 425582398 425582398 "01 ACTIVITES ARTISANALES" "1016 ARTISAN DES METIERS DE PARFUMERIE" 28 2022 13065762781 0 14192258087 86959173 1618198487 827892822 "01 ACTIVITES ARTISANALES" "1016 ARTISAN DES METIERS DE PARFUMERIE" 25 2023 14913668661 0 16150705593 109950628 1057123395 989942088 "01 ACTIVITES ARTISANALES" "1017 REVETEMENT TAPISSERIE TOUS GENRES" 3 2022 385347689 0 412217627 1665500 13655063 13655063 "01 ACTIVITES ARTISANALES" "1017 REVETEMENT TAPISSERIE TOUS GENRES" 3 2023 392317440 0 419779661 1399700 10997044 10997044 "01 ACTIVITES ARTISANALES" "1018 DISTIL.ARTIS/PLANTE ET FLEUR" 19 2022 790700095 0 856291901 6787000 43371697 43371697 "01 ACTIVITES ARTISANALES" "1018 DISTIL.ARTIS/PLANTE ET FLEUR" 15 2023 766185202 4721757 834357592 7920207 52029852 52029852 "01 ACTIVITES ARTISANALES" "1019 ART BIJOUX DE FANTAISIE" 1 2022 0 0 0 0 0 0 "01 ACTIVITES ARTISANALES" "1019 ART BIJOUX DE FANTAISIE" 1 2023 20500000 0 21935000 764100 5094130 5094130 "01 ACTIVITES ARTISANALES" "1023 ARTIS CONFISERIE TRADITION" 3 2022 0 0 0 300000 0 0 "01 ACTIVITES ARTISANALES" "1023 ARTIS CONFISERIE TRADITION" 3 2023 2093880524 0 2333577427 300000 0 0 "01 ACTIVITES ARTISANALES" "1024 ARTIS DES OBJETS D'ORNEMENT" 1 2022 93540000 0 93540000 300000 0 0 "01 ACTIVITES ARTISANALES" "1024 ARTIS DES OBJETS D'ORNEMENT" 1 2023 98747669 0 105660000 887500 8875373 8875373 "01 ACTIVITES ARTISANALES" "1025 ARTIS.ARTIC.DECOR ETBIBELOT" 11 2022 185158373 179767746 379008633 2743550 4957749 4957749 "01 ACTIVITES ARTISANALES" "1025 ARTIS.ARTIC.DECOR ETBIBELOT" 9 2023 182242831 167750731 362924240 12273000 82738288 82738288 "01 ACTIVITES ARTISANALES" "1032 BRODERIE MANUELLE" 4 2022 222364138 0 224957140 6867900 63679857 63679857 "01 ACTIVITES ARTISANALES" "1032 BRODERIE MANUELLE" 4 2023 305785869 0 340717904 9249100 87491753 87491753 "01 ACTIVITES ARTISANALES" "1035 FAB ARTISANALE D'OBJETS EN CIRE" 1 2022 109117371 0 117131305 2105400 14036000 14036000 "01 ACTIVITES ARTISANALES" "1035 FAB ARTISANALE D'OBJETS EN CIRE" 1 2023 0 0 0 0 0 0 "01 ACTIVITES ARTISANALES" "1039 PASSEMENTERIE MANUELLE" 2 2022 585723500 545885660 1172609805 1746271 11204400 11204400 "01 ACTIVITES ARTISANALES" "1039 PASSEMENTERIE MANUELLE" 1 2023 0 475045600 475045600 950091 1616883 1616883 "01 ACTIVITES ARTISANALES" "1999 AUTRES ACTIVITES ARTISANALES" 2 2022 0 0 0 1200000 0 0 "01 ACTIVITES ARTISANALES" "1999 AUTRES ACTIVITES ARTISANALES" 2 2023 0 0 0 900000 0 0 "02 ACTIVITES DE COMMERCE EN DETAIL" "2101 ALIMENTATION GENERALE" 429 2022 540151186595 0 579410977328 2657376599 15760090506 15787932127 "02 ACTIVITES DE COMMERCE EN DETAIL" "2101 ALIMENTATION GENERALE" 410 2023 543436225538 0 586433072901 2726422125 16347411162 16371499636 "02 ACTIVITES DE COMMERCE EN DETAIL" "2102 PATISSERIE , GLACE" 164 2022 139971108669 47045295 146159262939 666540902 3319104513 3331286346 "02 ACTIVITES DE COMMERCE EN DETAIL" "2102 PATISSERIE , GLACE" 158 2023 147014653109 0 152998996535 777744066 4078104402 4092140595 "02 ACTIVITES DE COMMERCE EN DETAIL" "2103 CCE D'EPICES ET SALAISONS" 71 2022 20837272136 0 21289621407 157141197 955713041 964864031 "02 ACTIVITES DE COMMERCE EN DETAIL" "2103 CCE D'EPICES ET SALAISONS" 67 2023 47972540014 0 48281965866 279746030 1517773164 1517773164 "02 ACTIVITES DE COMMERCE EN DETAIL" "2104 CCE PDUITS DE VIANDE ET DERIVES" 67 2022 29059238373 0 29337508613 258734593 1600295542 1647552281 "02 ACTIVITES DE COMMERCE EN DETAIL" "2104 CCE PDUITS DE VIANDE ET DERIVES" 66 2023 41877949912 0 40979822981 343989084 2146728111 2206081919 "02 ACTIVITES DE COMMERCE EN DETAIL" "2105 VTE POISSONS, CRUSTACES,MOLLUSQUES" 115 2022 92172461136 2230806287 96909872544 433078819 2592820717 2570486546 "02 ACTIVITES DE COMMERCE EN DETAIL" "2105 VTE POISSONS, CRUSTACES,MOLLUSQUES" 108 2023 102781561800 9203665700 112847363998 600694468 3852991338 3805563620 "02 ACTIVITES DE COMMERCE EN DETAIL" "2106 VENTE LEGUMES ET FRUITS" 41 2022 19448245331 0 19520557923 85086030 482252633 482252633 "02 ACTIVITES DE COMMERCE EN DETAIL" "2106 VENTE LEGUMES ET FRUITS" 43 2023 18998844519 0 19010036665 96998587 562462700 562462700 "02 ACTIVITES DE COMMERCE EN DETAIL" "2107 VTE VOLAILLES ET DERIVES" 109 2022 89476749432 0 90376464148 352591619 2153947864 2153945265 "02 ACTIVITES DE COMMERCE EN DETAIL" "2107 VTE VOLAILLES ET DERIVES" 98 2023 113910047340 0 115208542764 410661107 2295746511 2295746278 "02 ACTIVITES DE COMMERCE EN DETAIL" "2108 VTE FRUITS SECS" 34 2022 8222211194 0 8363531491 58695157 361818234 364478358 "02 ACTIVITES DE COMMERCE EN DETAIL" "2108 VTE FRUITS SECS" 26 2023 8837412931 0 8947122460 58119050 361646598 366952620 "02 ACTIVITES DE COMMERCE EN DETAIL" "2109 CCE VIN,BIERRE,LIQUEUR,SPIRITUEUX" 35 2022 294117361706 0 348189638763 2846958098 18295182634 18092682634 "02 ACTIVITES DE COMMERCE EN DETAIL" "2109 CCE VIN,BIERRE,LIQUEUR,SPIRITUEUX" 33 2023 290894596130 0 345576776146 2983653737 19570978783 19570978582 "02 ACTIVITES DE COMMERCE EN DETAIL" "2110 SUPERETTE" 198 2022 152814826422 0 162342357854 702960229 4046407434 4046404785 "02 ACTIVITES DE COMMERCE EN DETAIL" "2110 SUPERETTE" 189 2023 161588186822 0 174710150277 716636205 4072297665 4072296554 "02 ACTIVITES DE COMMERCE EN DETAIL" "2111 SUPER OU HYPERMARCHE" 45 2022 760532490139 0 815114941116 3720736711 15036122435 15036122055 "02 ACTIVITES DE COMMERCE EN DETAIL" "2111 SUPER OU HYPERMARCHE" 43 2023 813449720547 0 872869031488 2178848247 10566795082 10566794952 "02 ACTIVITES DE COMMERCE EN DETAIL" "2112 COLLECTE DE LAIT" 2 2022 15072850540 0 15072850540 0 483888877 0 "02 ACTIVITES DE COMMERCE EN DETAIL" "2112 COLLECTE DE LAIT" 2 2023 17499533450 0 17499533450 30040650 573211594 200271693 "02 ACTIVITES DE COMMERCE EN DETAIL" "2113 VTE LAIT,DERIVES" 92 2022 321929279940 0 322150129246 648459633 7455303728 4061740509 "02 ACTIVITES DE COMMERCE EN DETAIL" "2113 VTE LAIT,DERIVES" 102 2023 365809489423 0 366344710817 680270342 6004955277 4021611030 "02 ACTIVITES DE COMMERCE EN DETAIL" "2114 VENTE HUILES" 11 2022 11465301868 27778306 11493080174 31334850 180412637 180412637 "02 ACTIVITES DE COMMERCE EN DETAIL" "2114 VENTE HUILES" 10 2023 12396561156 0 12433489013 47883818 282864684 282864684 "02 ACTIVITES DE COMMERCE EN DETAIL" "2115 VTE. HUILE ESSENC,AROM ET INGRED" 7 2022 137795000 0 140172250 2595050 3967039 3967039 "02 ACTIVITES DE COMMERCE EN DETAIL" "2115 VTE. HUILE ESSENC,AROM ET INGRED" 4 2023 388920126 0 457626383 1915252 5737854 5737854 "02 ACTIVITES DE COMMERCE EN DETAIL" "2116 VENTE CEREALES" 2 2022 948857300 0 948857300 2096250 13975433 13975433 "02 ACTIVITES DE COMMERCE EN DETAIL" "2116 VENTE CEREALES" 3 2023 1610343650 0 1610343650 5737500 38251439 38251439 "02 ACTIVITES DE COMMERCE EN DETAIL" "2117 VTE CONFISERIE,BISC,CHOCOLAT" 13 2022 3996720674 0 4086706159 21783458 95457478 95457418 "02 ACTIVITES DE COMMERCE EN DETAIL" "2117 VTE CONFISERIE,BISC,CHOCOLAT" 16 2023 4635436300 0 4757459028 16127017 50071410 50070647 "02 ACTIVITES DE COMMERCE EN DETAIL" "2118 COMMERCE DES DATTES" 1 2022 0 0 0 0 0 0 "02 ACTIVITES DE COMMERCE EN DETAIL" "2119 HYPERMARCHE" 8 2022 2396102402360 0 2635059701626 14317672690 52974345537 52974345537 "02 ACTIVITES DE COMMERCE EN DETAIL" "2119 HYPERMARCHE" 10 2023 2476279159121 5.940e+08 2675784361971 9969300508 33352205916 33352205916 "02 ACTIVITES DE COMMERCE EN DETAIL" "2120 CCE ALIM DIETET ET COMPL ALIM" 15 2022 1244613650 0 1435880905 10310844 51776000 51776000 "02 ACTIVITES DE COMMERCE EN DETAIL" "2120 CCE ALIM DIETET ET COMPL ALIM" 11 2023 2051121210 0 2412588365 23358450 145723973 145723973 "02 ACTIVITES DE COMMERCE EN DETAIL" "2201 CCE HABILLEMENT,PRET A PORTER" 835 2022 533033460262 202389947 632285801072 3148087691 17494420933 17515845927 "02 ACTIVITES DE COMMERCE EN DETAIL" "2201 CCE HABILLEMENT,PRET A PORTER" 804 2023 542408942066 270989316 642110345533 3108792587 15850167587 15840775865 "02 ACTIVITES DE COMMERCE EN DETAIL" "2202 COMMERCE FRIPERIE" 12 2022 8793673735 0 10576671114 29517135 171213287 171639287 "02 ACTIVITES DE COMMERCE EN DETAIL" "2202 COMMERCE FRIPERIE" 10 2023 2461013198 0 2820021531 24610499 140289785 140851375 "02 ACTIVITES DE COMMERCE EN DETAIL" "2203 COMMERCE PDUITS TEXTILES" 332 2022 154880154468 37160829 182785671024 1064551895 5345587462 5458446860 "02 ACTIVITES DE COMMERCE EN DETAIL" "2203 COMMERCE PDUITS TEXTILES" 319 2023 143313920399 127274470 169277071171 1098693231 5822193123 5942376344 "02 ACTIVITES DE COMMERCE EN DETAIL" "2204 VTE PDTS BONNETERIE,MERCERIE" 18 2022 3932246733 0 4629961436 31873977 155079133 167406121 "02 ACTIVITES DE COMMERCE EN DETAIL" "2204 VTE PDTS BONNETERIE,MERCERIE" 19 2023 3627583792 11800480 4267490582 33761242 163518115 178486863 "02 ACTIVITES DE COMMERCE EN DETAIL" "2205 COMMERCE CHAUSSURES" 154 2022 89248550662 0 105633533692 917920517 5751060094 5566501068 end
The first variable is the activity sector, the second variable is the specific activity of the firm, the third variable is the number of firms in the specific activity sector that are active and did pay taxes, the fourth variable is the year (here, it is either 2022 or 2023), the fifth variable is the Local Turnover without taxes, the sixth variable is the Exportation Turnover, the seventh variable is the Total Turnover with Taxes, the eigth variable is the Taxes to pay, the ninth is the total fiscal benefit, and the last variable is the total taxable benefit.
My goal here is to have the number of firms by the activity sector (the first variable), for each year. I've tried to use the "Total" command, but I guess it didn't work. I just want the result to be displayed on Stata, not to create a new variable. The goal is to sum up the "the number of firms in the specific activity sector" (third variable) by year (the fourth variable) and by activity sector (first variable).
Any help please?
With thanks!
Comment