-
Notifications
You must be signed in to change notification settings - Fork 0
/
labs_aneo.do
4731 lines (3976 loc) · 191 KB
/
labs_aneo.do
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
**TODO 1. verificare per vc_200087 (vedi commento)
/***
vc_203010 vc_203100 vc_203102 vc_206007 vc_207000 marketcap datemarkcap attivigb s_innod_primary_business_line
s_innod_secondary_business_line s_innod_main_activitys_innod_secondary_activity s_innod_main_products_services vc_1121
****/
/*** controlla l'installazione di strrec, se non c'è, procede all'installazione
commentare questa procedura se il pc non è connesso ad internet
o se non avete le credenziali per poter installare files sul vostro PC ***/
qui capture which strrec
if _rc {
ssc inst strrec
}
label drop _all
/*****************************
**** PROGs DEFINITION ****
*****************************/
capture program drop prov_num
program define prov_num
tempvar anno
gen `anno' = 2020
capture replace `anno'=anno
replace `1'="84" if `1'=="Agrigento"
replace `1'="6" if `1'=="Alessandria"
replace `1'="42" if `1'=="Ancona"
replace `1'="7" if inlist(`1',"Aosta","Valle d'Aosta/Vallée d'Aoste","Valle d’Aosta/Vallée D’Aoste")
replace `1'="51" if `1'=="Arezzo"
replace `1'="44" if `1'=="Ascoli Piceno"
replace `1'="5" if `1'=="Asti"
replace `1'="64" if `1'=="Avellino"
replace `1'="72" if `1'=="Bari"
replace `1'="25" if `1'=="Belluno"
replace `1'="62" if `1'=="Benevento"
replace `1'="16" if `1'=="Bergamo"
replace `1'="96" if `1'=="Biella"
replace `1'="37" if `1'=="Bologna"
replace `1'="21" if inlist(`1',"Bolzano","Bolzano/Bozen")
replace `1'="17" if `1'=="Brescia"
replace `1'="74" if `1'=="Brindisi"
replace `1'="92" if `1'=="Cagliari"
replace `1'="85" if `1'=="Caltanissetta"
replace `1'="70" if `1'=="Campobasso"
replace `1'="61" if `1'=="Caserta"
replace `1'="87" if `1'=="Catania"
replace `1'="79" if `1'=="Catanzaro"
replace `1'="69" if `1'=="Chieti"
replace `1'="13" if `1'=="Como"
replace `1'="78" if `1'=="Cosenza"
replace `1'="19" if `1'=="Cremona"
replace `1'="101" if inlist(`1',"Crotone","CrotoneValentia")
replace `1'="4" if `1'=="Cuneo"
replace `1'="86" if `1'=="Enna"
replace `1'="38" if `1'=="Ferrara"
replace `1'="48" if `1'=="Firenze"
replace `1'="71" if `1'=="Foggia"
replace `1'="40" if inlist(`1',"Forl¡","Forl¡-Cesana","Forli","Forlì-Cesena")
replace `1'="60" if `1'=="Frosinone"
replace `1'="10" if `1'=="Genova"
replace `1'="31" if `1'=="Gorizia"
replace `1'="53" if `1'=="Grosseto"
replace `1'="8" if `1'=="Imperia"
replace `1'="94" if `1'=="Isernia"
replace `1'="11" if `1'=="L'Aquila"
replace `1'="66" if `1'=="La Spezia"
replace `1'="59" if `1'=="Latina"
replace `1'="75" if `1'=="Lecce"
replace `1'="97" if `1'=="Lecco"
replace `1'="49" if `1'=="Livorno"
replace `1'="98" if `1'=="Lodi"
replace `1'="46" if `1'=="Lucca"
replace `1'="43" if `1'=="Macerata"
replace `1'="20" if `1'=="Mantova"
replace `1'="45" if `1'=="Massa-Carrara"
replace `1'="77" if `1'=="Matera"
replace `1'="83" if `1'=="Messina"
replace `1'="15" if `1'=="Milano"
replace `1'="36" if `1'=="Modena"
replace `1'="63" if `1'=="Napoli"
replace `1'="3" if `1'=="Novara"
replace `1'="91" if `1'=="Nuoro"
replace `1'="95" if `1'=="Oristano"
replace `1'="28" if `1'=="Padova"
replace `1'="82" if `1'=="Palermo"
replace `1'="34" if `1'=="Parma"
replace `1'="18" if `1'=="Pavia"
replace `1'="54" if `1'=="Perugia"
replace `1'="41" if inlist(`1',"Pesaro e Urbino","Pesaro Urbino")
replace `1'="68" if `1'=="Pescara"
replace `1'="33" if `1'=="Piacenza"
replace `1'="50" if `1'=="Pisa"
replace `1'="47" if `1'=="Pistoia"
replace `1'="93" if `1'=="Pordenone"
replace `1'="76" if `1'=="Potenza"
replace `1'="100" if `1'=="Prato"
replace `1'="88" if `1'=="Ragusa"
replace `1'="39" if `1'=="Ravenna"
replace `1'="80" if inlist(`1',"Reggio Calabria","Reggio di Calabria")
replace `1'="35" if inlist(`1',"Reggio Emilia","Reggio nell'Emilia")
replace `1'="57" if `1'=="Rieti"
replace `1'="99" if inlist(`1',"Rimini","RiminiEmilia")
replace `1'="58" if `1'=="Roma"
replace `1'="29" if `1'=="Rovigo"
replace `1'="65" if `1'=="Salerno"
replace `1'="90" if `1'=="Sassari"
replace `1'="9" if inlist(`1',"Savona","SavonaSpezia")
replace `1'="52" if `1'=="Siena"
replace `1'="89" if `1'=="Siracusa"
replace `1'="14" if `1'=="Sondrio"
replace `1'="73" if `1'=="Taranto"
replace `1'="67" if `1'=="Teramo"
replace `1'="55" if `1'=="Terni"
replace `1'="1" if `1'=="Torino"
replace `1'="81" if `1'=="Trapani"
replace `1'="22" if `1'=="Trento"
replace `1'="26" if `1'=="Treviso"
replace `1'="32" if `1'=="Trieste"
replace `1'="30" if `1'=="Udine"
replace `1'="12" if `1'=="Varese"
replace `1'="27" if `1'=="Venezia"
replace `1'="103" if inlist(`1',"Verbania","Verbano-Cusio-Ossola")
replace `1'="2" if `1'=="Vercelli"
replace `1'="23" if `1'=="Verona"
replace `1'="102" if `1'=="Vibo Valentia"
replace `1'="24" if `1'=="Vicenza"
replace `1'="56" if `1'=="Viterbo"
replace `1'="15" if inlist(`1',"Monza Brianza","Monza e della Brianza") & `anno'<2009
replace `1'="108" if inlist(`1',"Monza Brianza","Monza e della Brianza") & `anno'>=2009
replace `1'="109" if `1'=="Fermo"
replace `1'="110" if `1'=="Barletta-Andria-Trani"
replace `1'="106" if `1'=="Medio Campidano"
replace `1'="105" if `1'=="Ogliastra"
replace `1'="104" if `1'=="Olbia-Tempio"
replace `1'="107" if `1'=="Carbonia-Iglesias"
replace `1'="111" if `1'=="Sud Sardegna"
replace `1'="" if inlist(`1',"-","Emilia-Romagna","Friuli-Venezia Giulia","Lazio","Lombardia","Umbria")
destring `1', replace
confirm numeric variable `1'
label values `1' cod_prov
end
capture program drop regio_num
program define regio_num
replace `1'=lower(`1')
replace `1'="" if inlist(`1',"-","san marino")
replace `1'="13" if `1'=="abruzzo"
replace `1'="17" if `1'=="basilicata"
replace `1'="18" if `1'=="calabria"
replace `1'="15" if `1'=="campania"
replace `1'="8" if inlist(`1',"emilia-romagna","emilia romagna")
replace `1'="6" if inlist(`1',"friuli venezia giulia","friuli","friuli-venezia giulia","friuli-venezia")
replace `1'="12" if `1'=="lazio"
replace `1'="7" if `1'=="liguria"
replace `1'="3" if `1'=="lombardia"
replace `1'="11" if `1'=="marche"
replace `1'="14" if `1'=="molise"
replace `1'="1" if `1'=="piemonte"
replace `1'="16" if `1'=="puglia"
replace `1'="20" if `1'=="sardegna"
replace `1'="19" if `1'=="sicilia"
replace `1'="9" if `1'=="toscana"
replace `1'="4" if inlist(`1',"trentino-alto adige","trentino","trentino-alto")
replace `1'="10" if `1'=="umbria"
replace `1'="2" if inlist(`1',"valle d'aosta","valle d'aosta/vallée d'aoste","valle d'aosta/")
replace `1'="5" if `1'=="veneto"
replace `1'="21" if `1'=="estero"
destring `1', replace
confirm numeric variable `1'
label values `1' cod_reg
end
capture program drop REF_INDEX
program define REF_INDEX
gen TMP=`1'
count if `1'==""
local pre_miss = r(N)
strrec `1' ("FTSE MIB INDEX" = 1 "FTSE MIB INDEX") ///
("FTSE ITALIA STAR" = 2 "FTSE ITALIA STAR") ///
("FTSE ITALIA MID CAP INDEX" = 3 "FTSE ITALIA MID CAP INDEX") ///
("FTSE 100" = 4 "FTSE 100") ///
("FTSE EUROTOP 100" = 5 "FTSE EUROTOP 100") ///
("CAC 40" = 6 "CAC 40") ///
("DOW JONES EURO STOXX 50" = 7 "DOW JONES EURO STOXX 50") ///
("DOW JONES STOXX 50" = 8 "DOW JONES STOXX 50") ///
("DOW JONES INDUSTRIAL AVERAGE" = 9 "DOW JONES INDUSTRIAL AVERAGE") ///
("NYSE COMPOSITE INDEX" = 10 "NYSE COMPOSITE INDEX") ///
("S&P 500 INDUSTRIAL COMPOSITE" = 11 "S&P 500 INDUSTRIAL COMPOSITE") ///
("DAX PERFORMANCE (DEUTSCHER AKTIENINDEX PERFORMANCE-INDEX*" = 12 "DAX PERFORMANCE (DEUTSCHER AKTIENINDEX PERFORMANCE-INDEX)") ///
("NASDAQ COMPOSITE" = 13 "NASDAQ COMPOSITE") ///
("SMI (SWISS MARKET INDEX)" = 14 "SMI (SWISS MARKET INDEX)") ///
("MIB 30" = 15 "MIB 30") ///
("SBF 120" = 16 "SBF 120") ///
("IT.CAC" = 17 "IT.CAC") ///
, define(`1') replace casesensitive sub
qui count if `1'==.
if `pre_miss' == r(N) {
drop TMP
macro drop pre_miss
}
else {
fre TMP if `1'==.
drop TMP
macro drop pre_miss
error 181
}
end
capture program drop BORSE
program define BORSE
gen TMP=`1'
count if `1'==""
local pre_miss = r(N)
strrec `1' ("Delistata" = 0 "Delistata") ///
("Borsa Italiana - MTA (Mercato Telematico Azionario)" "Italian Continuous Market" = 1 "Borsa Italiana - MTA (Mercato Telematico Azionario)") ///
("Boerse Frankfurt" "Frankfurt Stock Exchange" = 2 "Boerse Frankfurt") ///
("Boerse Berlin" = 3 "Boerse Berlin") ///
("Euronext Paris" = 4 "Euronext Paris") ///
("Euronext Brussels" = 5 "Euronext Brussels") ///
("Berlin Stock Exchange" = 6 "Berlin Stock Exchange") ///
("Hong Kong Stock Exchange" = 7 "Hong Kong Stock Exchange") ///
("London Stock Exchange","London Stock Exchange (SEAQ)" = 8 "London Stock Exchange") ///
("New York Stock Exchange" "New York Stock Exchange (NYSE)" = 9 "New York Stock Exchange") ///
("Mercato Alternativo del Capitale" "AIM Italia - Mercato Alternativo del Capitale" = 10 "Mercato Alternativo del Capitale") ///
("NASDAQ National Market" = 11 "NASDAQ National Market") ///
("OTC Pink Market" = 12 "OTC Pink Market") ///
("Pink Sheets Grey Market" = 13 "Pink Sheets Grey Market") ///
("Swiss Exchange" "Swiss Exchange (SWX)" = 14 "Swiss Exchange") ///
("Boerse Stuttgart" = 15 "Boerse Stuttgart") ///
("OTC Bulletin Board" = 16 "OTC Bulletin Board") ///
("Non quotata" = .a "Non quotata") ///
, define(`1') replace casesensitive sub
qui count if `1'==.
if `pre_miss' == r(N) {
drop TMP
macro drop pre_miss
}
else {
di "Questi non sono stati ricodificati!"
fre TMP if `1'==.
drop TMP
macro drop pre_miss
error 181
}
end
capture program drop ISO_A2
program define ISO_A2
** riferimento: http://www.nationsonline.org/oneworld/country_code_list.htm
replace `1'="" if `1'=="-"
gen TMP=`1'
count if `1'==""
local pre_miss = r(N)
strrec `1' ("AF" = 4 "Afghanistan" /* AFG */ ) ///
("AL" = 8 "Albania" /* ALB */ ) ///
("DZ" = 12 "Algeria" /* DZA */ ) ///
("AD" = 20 "Andorra" /* AND */ ) ///
("AO" = 24 "Angola" /* AGO */ ) ///
("AI" = 660 "Anguilla" /* AIA */ ) ///
("AQ" = 10 "Antartide" /* ATA */ ) ///
("AG" = 28 "Antigua e Barbuda" /* ATG */ ) ///
("SA" = 682 "Arabia Saudita" /* SAU */ ) ///
("AR" = 32 "Argentina" /* ARG */ ) ///
("AM" = 51 "Armenia" /* ARM */ ) ///
("AW" = 533 "Aruba" /* ABW */ ) ///
("AU" = 36 "Australia" /* AUS */ ) ///
("AT" = 40 "Austria" /* AUT */ ) ///
("AZ" = 31 "Azerbaigian" /* AZE */ ) ///
("BS" = 44 "Bahamas" /* BHS */ ) ///
("BH" = 48 "Bahrain" /* BHR */ ) ///
("BD" = 50 "Bangladesh" /* BGD */ ) ///
("BB" = 52 "Barbados" /* BRB */ ) ///
("BE" = 56 "Belgio" /* BEL */ ) ///
("BZ" = 84 "Belize" /* BLZ */ ) ///
("BJ" = 204 "Benin" /* BEN */ ) ///
("BM" = 60 "Bermuda" /* BMU */ ) ///
("BT" = 64 "Bhutan" /* BTN */ ) ///
("BY" = 112 "Bielorussia" /* BLR */ ) ///
("MM" = 104 "Birmania" /* MMR */ ) ///
("BO" = 68 "Bolivia" /* BOL */ ) ///
("BA" = 70 "Bosnia ed Erzegovina" /* BIH */ ) ///
("BW" = 72 "Botswana" /* BWA */ ) ///
("BR" = 76 "Brasile" /* BRA */ ) ///
("BN" = 96 "Brunei" /* BRN */ ) ///
("BG" = 100 "Bulgaria" /* BGR */ ) ///
("BF" = 854 "Burkina Faso" /* BFA */ ) ///
("BI" = 108 "Burundi" /* BDI */ ) ///
("KH" = 116 "Cambogia" /* KHM */ ) ///
("CM" = 120 "Camerun" /* CMR */ ) ///
("CA" = 124 "Canada" /* CAN */ ) ///
("CV" = 132 "Capo Verde" /* CPV */ ) ///
("TD" = 148 "Ciad" /* TCD */ ) ///
("CL" = 152 "Cile" /* CHL */ ) ///
("CN" = 156 "Cina" /* CHN */ ) ///
("CY" = 196 "Cipro" /* CYP */ ) ///
("VA" = 336 "Città del Vaticano" /* VAT */ ) ///
("CO" = 170 "Colombia" /* COL */ ) ///
("KM" = 174 "Comore" /* COM */ ) ///
("KP" = 408 "Corea del Nord" /* PRK */ ) ///
("KR" = 410 "Corea del Sud" /* KOR */ ) ///
("CI" = 384 "Costa d'Avorio" /* CIV */ ) ///
("CR" = 188 "Costa Rica" /* CRI */ ) ///
("HR" = 191 "Croazia" /* HRV */ ) ///
("CU" = 192 "Cuba" /* CUB */ ) ///
("CW" = 531 "Curaçao" /* CUW */ ) ///
("DK" = 208 "Danimarca" /* DNK */ ) ///
("DM" = 212 "Dominica" /* DMA */ ) ///
("EC" = 218 "Ecuador" /* ECU */ ) ///
("EG" = 818 "Egitto" /* EGY */ ) ///
("SV" = 222 "El Salvador" /* SLV */ ) ///
("AE" = 784 "Emirati Arabi Uniti" /* ARE */ ) ///
("ER" = 232 "Eritrea" /* ERI */ ) ///
("EE" = 233 "Estonia" /* EST */ ) ///
("ET" = 231 "Etiopia" /* ETH */ ) ///
("FJ" = 242 "Figi" /* FJI */ ) ///
("PH" = 608 "Filippine" /* PHL */ ) ///
("FI" = 246 "Finlandia" /* FIN */ ) ///
("FR" = 250 "Francia" /* FRA */ ) ///
("GA" = 266 "Gabon" /* GAB */ ) ///
("GM" = 270 "Gambia" /* GMB */ ) ///
("GE" = 268 "Georgia" /* GEO */ ) ///
("GS" = 239 "Georgia del Sud e isole Sandwich" /* SGS */ ) ///
("DE" = 276 "Germania" /* DEU */ ) ///
("GH" = 288 "Ghana" /* GHA */ ) ///
("JM" = 388 "Giamaica" /* JAM */ ) ///
("JP" = 392 "Giappone" /* JPN */ ) ///
("GI" = 292 "Gibilterra" /* GIB */ ) ///
("DJ" = 262 "Gibuti" /* DJI */ ) ///
("JO" = 400 "Giordania" /* JOR */ ) ///
("GR" = 300 "Grecia" /* GRC */ ) ///
("GD" = 308 "Grenada" /* GRD */ ) ///
("GL" = 304 "Groenlandia" /* GRL */ ) ///
("GP" = 312 "Guadalupa" /* GLP */ ) ///
("GU" = 316 "Guam" /* GUM */ ) ///
("GT" = 320 "Guatemala" /* GTM */ ) ///
("GG" = 831 "Guernsey" /* GGY */ ) ///
("GN" = 324 "Guinea" /* GIN */ ) ///
("GW" = 624 "Guinea-Bissau" /* GNB */ ) ///
("GQ" = 226 "Guinea Equatoriale" /* GNQ */ ) ///
("GY" = 328 "Guyana" /* GUY */ ) ///
("GF" = 254 "Guyana Francese" /* GUF */ ) ///
("HT" = 332 "Haiti" /* HTI */ ) ///
("HN" = 340 "Honduras" /* HND */ ) ///
("HK" = 344 "Hong Kong" /* HKG */ ) ///
("IN" = 356 "India" /* IND */ ) ///
("ID" = 360 "Indonesia" /* IDN */ ) ///
("IR" = 364 "Iran" /* IRN */ ) ///
("IQ" = 368 "Iraq" /* IRQ */ ) ///
("IE" = 372 "Irlanda" /* IRL */ ) ///
("IS" = 352 "Islanda" /* ISL */ ) ///
("BV" = 74 "Isola Bouvet" /* BVT */ ) ///
("IM" = 833 "Isola di Man" /* IMN */ ) ///
("CX" = 162 "Isola di Natale" /* CXR */ ) ///
("NF" = 574 "Isola Norfolk" /* NFK */ ) ///
("AX" = 248 "Isole Åland" /* ALA */ ) ///
("BQ" = 535 "Isole BES" /* BES */ ) ///
("KY" = 136 "Isole Cayman" /* CYM */ ) ///
("CC" = 166 "Isole Cocos e Keeling" /* CCK */ ) ///
("CK" = 184 "Isole Cook" /* COK */ ) ///
("FO" = 234 "Isole Fær Øer" /* FRO */ ) ///
("FK" = 238 "Isole Falkland" /* FLK */ ) ///
("HM" = 334 "Isole Heard e McDonald" /* HMD */ ) ///
("MP" = 580 "Isole Marianne Settentrionali" /* MNP */ ) ///
("MH" = 584 "Isole Marshall" /* MHL */ ) ///
("UM" = 581 "Isole minori degli Stati Uniti" /* UMI */ ) ///
("PN" = 612 "Isole Pitcairn" /* PCN */ ) ///
("SB" = 90 "Isole Salomone" /* SLB */ ) ///
("VG" = 92 "Isole Vergini britanniche" /* VGB */ ) ///
("VI" = 850 "Isole Vergini americane" /* VIR */ ) ///
("IL" = 376 "Israele" /* ISR */ ) ///
("IT" = 380 "Italia" /* ITA */ ) ///
("JE" = 832 "Jersey" /* JEY */ ) ///
("KZ" = 398 "Kazakistan" /* KAZ */ ) ///
("KE" = 404 "Kenya" /* KEN */ ) ///
("KG" = 417 "Kirghizistan" /* KGZ */ ) ///
("KI" = 296 "Kiribati" /* KIR */ ) ///
("KW" = 414 "Kuwait" /* KWT */ ) ///
("LA" = 418 "Laos" /* LAO */ ) ///
("LS" = 426 "Lesotho" /* LSO */ ) ///
("LV" = 428 "Lettonia" /* LVA */ ) ///
("LB" = 422 "Libano" /* LBN */ ) ///
("LR" = 430 "Liberia" /* LBR */ ) ///
("LY" = 434 "Libia" /* LBY */ ) ///
("LI" = 438 "Liechtenstein" /* LIE */ ) ///
("LT" = 440 "Lituania" /* LTU */ ) ///
("LU" = 442 "Lussemburgo" /* LUX */ ) ///
("MO" = 446 "Macao" /* MAC */ ) ///
("MK" = 807 "Repubblica di Macedonia" /* MKD */ ) ///
("MG" = 450 "Madagascar" /* MDG */ ) ///
("MW" = 454 "Malawi" /* MWI */ ) ///
("MY" = 458 "Malesia" /* MYS */ ) ///
("MV" = 462 "Maldive" /* MDV */ ) ///
("ML" = 466 "Mali" /* MLI */ ) ///
("MT" = 470 "Malta" /* MLT */ ) ///
("MA" = 504 "Marocco" /* MAR */ ) ///
("MQ" = 474 "Martinica" /* MTQ */ ) ///
("MR" = 478 "Mauritania" /* MRT */ ) ///
("MU" = 480 "Mauritius" /* MUS */ ) ///
("YT" = 175 "Mayotte" /* MYT */ ) ///
("MX" = 484 "Messico" /* MEX */ ) ///
("FM" = 583 "Micronesia" /* FSM */ ) ///
("MD" = 498 "Moldavia" /* MDA */ ) ///
("MN" = 496 "Mongolia" /* MNG */ ) ///
("ME" = 499 "Montenegro" /* MNE */ ) ///
("MS" = 500 "Montserrat" /* MSR */ ) ///
("MZ" = 508 "Mozambico" /* MOZ */ ) ///
("NA" = 516 "Namibia" /* NAM */ ) ///
("NR" = 520 "Nauru" /* NRU */ ) ///
("NP" = 524 "Nepal" /* NPL */ ) ///
("NI" = 558 "Nicaragua" /* NIC */ ) ///
("NE" = 562 "Niger" /* NER */ ) ///
("NG" = 566 "Nigeria" /* NGA */ ) ///
("NU" = 570 "Niue" /* NIU */ ) ///
("NO" = 578 "Norvegia" /* NOR */ ) ///
("NC" = 540 "Nuova Caledonia" /* NCL */ ) ///
("NZ" = 554 "Nuova Zelanda" /* NZL */ ) ///
("OM" = 512 "Oman" /* OMN */ ) ///
("NL" = 528 "Paesi Bassi" /* NLD */ ) ///
("PK" = 586 "Pakistan" /* PAK */ ) ///
("PW" = 585 "Palau" /* PLW */ ) ///
("PS" = 275 "Stato di Palestina" /* PSE */ ) ///
("PA" = 591 "Panamá" /* PAN */ ) ///
("PG" = 598 "Papua Nuova Guinea" /* PNG */ ) ///
("PY" = 600 "Paraguay" /* PRY */ ) ///
("PE" = 604 "Perù" /* PER */ ) ///
("PF" = 258 "Polinesia francese" /* PYF */ ) ///
("PL" = 616 "Polonia" /* POL */ ) ///
("PR" = 630 "Porto Rico" /* PRI */ ) ///
("PT" = 620 "Portogallo" /* PRT */ ) ///
("MC" = 492 "Monaco" /* MCO */ ) ///
("QA" = 634 "Qatar" /* QAT */ ) ///
("GB" = 826 "Regno Unito" /* GBR */ ) ///
("CD" = 180 "Repubblica Democratica del Congo" /* COD */ ) ///
("CZ" = 203 "Repubblica Ceca" /* CZE */ ) ///
("CF" = 140 "Repubblica Centrafricana" /* CAF */ ) ///
("CG" = 178 "Repubblica del Congo" /* COG */ ) ///
("DO" = 214 "Repubblica Dominicana" /* DOM */ ) ///
("RE" = 638 "Riunione" /* REU */ ) ///
("RO" = 642 "Romania" /* ROU */ ) ///
("RW" = 646 "Ruanda" /* RWA */ ) ///
("RU" = 643 "Russia" /* RUS */ ) ///
("EH" = 732 "Sahara Occidentale" /* ESH */ ) ///
("KN" = 659 "Saint Kitts e Nevis" /* KNA */ ) ///
("LC" = 662 "Santa Lucia" /* LCA */ ) ///
("SH" = 654 "Sant'Elena" /* SHN */ ) ///
("VC" = 670 "Saint Vincent e Grenadine" /* VCT */ ) ///
("BL" = 652 "Saint-Barthélemy" /* BLM */ ) ///
("MF" = 663 "Saint-Martin" /* MAF */ ) ///
("PM" = 666 "Saint-Pierre e Miquelon" /* SPM */ ) ///
("WS" = 882 "Samoa" /* WSM */ ) ///
("AS" = 16 "Samoa americane" /* ASM */ ) ///
("SM" = 674 "San Marino" /* SMR */ ) ///
("ST" = 678 "São Tomé e Príncipe" /* STP */ ) ///
("SN" = 686 "Senegal" /* SEN */ ) ///
("RS" = 688 "Serbia" /* SRB */ ) ///
("SC" = 690 "Seychelles" /* SYC */ ) ///
("SL" = 694 "Sierra Leone" /* SLE */ ) ///
("SG" = 702 "Singapore" /* SGP */ ) ///
("SX" = 534 "Sint Maarten" /* SXM */ ) ///
("SY" = 760 "Siria" /* SYR */ ) ///
("SK" = 703 "Slovacchia" /* SVK */ ) ///
("SI" = 705 "Slovenia" /* SVN */ ) ///
("SO" = 706 "Somalia" /* SOM */ ) ///
("ES" = 724 "Spagna" /* ESP */ ) ///
("LK" = 144 "Sri Lanka" /* LKA */ ) ///
("US" = 840 "Stati Uniti d'America" /* USA */ ) ///
("ZA" = 710 "Sudafrica" /* ZAF */ ) ///
("SD" = 729 "Sudan" /* SDN */ ) ///
("SS" = 728 "Sudan del Sud" /* SSD */ ) ///
("SR" = 740 "Suriname" /* SUR */ ) ///
("SJ" = 744 "Svalbard e Jan Mayen" /* SJM */ ) ///
("SE" = 752 "Svezia" /* SWE */ ) ///
("CH" = 756 "Svizzera" /* CHE */ ) ///
("SZ" = 748 "Swaziland" /* SWZ */ ) ///
("TW" = 158 "Taiwan" /* TWN */ ) ///
("TJ" = 762 "Tagikistan" /* TJK */ ) ///
("TZ" = 834 "Tanzania" /* TZA */ ) ///
("TF" = 260 "Terre Australi e Antartiche Francesi" /* ATF */ ) ///
("IO" = 86 "Territorio britannico dell'oceano Indiano" /* IOT */ ) ///
("TH" = 764 "Thailandia" /* THA */ ) ///
("TL" = 626 "Timor Est" /* TLS */ ) ///
("TG" = 768 "Togo" /* TGO */ ) ///
("TK" = 772 "Tokelau" /* TKL */ ) ///
("TO" = 776 "Tonga" /* TON */ ) ///
("TT" = 780 "Trinidad e Tobago" /* TTO */ ) ///
("TN" = 788 "Tunisia" /* TUN */ ) ///
("TR" = 792 "Turchia" /* TUR */ ) ///
("TM" = 795 "Turkmenistan" /* TKM */ ) ///
("TC" = 796 "Turks e Caicos" /* TCA */ ) ///
("TV" = 798 "Tuvalu" /* TUV */ ) ///
("UA" = 804 "Ucraina" /* UKR */ ) ///
("UG" = 800 "Uganda" /* UGA */ ) ///
("HU" = 348 "Ungheria" /* HUN */ ) ///
("UY" = 858 "Uruguay" /* URY */ ) ///
("UZ" = 860 "Uzbekistan" /* UZB */ ) ///
("VU" = 548 "Vanuatu" /* VUT */ ) ///
("VE" = 862 "Venezuela" /* VEN */ ) ///
("VN" = 704 "Vietnam" /* VNM */ ) ///
("WF" = 876 "Wallis e Futuna" /* WLF */ ) ///
("YE" = 887 "Yemen" /* YEM */ ) ///
("ZM" = 894 "Zambia" /* ZMB */ ) ///
("ZW" = 716 "Zimbabwe" /* ZWE */ ) ///
("AN" = .z "AN -> Indefinto" ) ///
("n.d." = .y "n.d." ) ///
, define(`1') replace casesensitive sub
qui count if `1'==.
if `pre_miss' == r(N) {
drop TMP
macro drop pre_miss
}
else {
di "Questi non sono stati ricodificati!"
fre TMP if `1'==.
drop TMP
macro drop pre_miss
error 181
}
end
capture program drop ORIGINE
program define ORIGINE
/*** ???????? ***/
replace `1'="" if inlist(`1',"-")
gen TMP=`1'
count if `1'==""
local pre_miss = r(N)
strrec `1' ("AR"=1 "AR") ///
("BD"=2 "BD") ///
("BI"=3 "BI") ///
("BV"=4 "BV") ///
("CB"=5 "CB") ///
("CA"=6 "CA") ///
("CI"=7 "CI") ///
("CP"=8 "CP") ///
("CT"=9 "CT") ///
("CU"=10 "CU") ///
("DP"=11 "DP") ///
("EC"=12 "EC") ///
("ED"=13 "ED") ///
("FA"=14 "FA") ///
("FC"=15 "FC") ///
("FI"=16 "FI") ///
("FS"=17 "FS") ///
("GA"=18 "GA") ///
("HO"=19 "HO") ///
("HR"=20 "HR") ///
("HS"=21 "HS") ///
("IA"=22 "IA") ///
("ID"=23 "ID") ///
("IH"=24 "IH") ///
("II"=25 "II") ///
("IN"=26 "IN") ///
("IP"=27 "IP") ///
("IR"=28 "IR") ///
("IS"=29 "IS") ///
("IV"=30 "IV") ///
("IW"=31 "IW") ///
("JO"=32 "JO") ///
("KO"=33 "KO") ///
("LN"=34 "LN") ///
("MI"=35 "MI") ///
("MO"=36 "MO") ///
("NB"=37 "NB") ///
("NC"=38 "NC") ///
("OF"=39 "OF") ///
("OS"=40 "OS") ///
("PC"=41 "PC") ///
("PE"=42 "PE") ///
("PX"=43 "PX") ///
("RM"=44 "RM") ///
("RS"=45 "RS") ///
("SC"=46 "SC") ///
("SE"=47 "SE") ///
("SH"=48 "SH") ///
("ST"=49 "ST") ///
("TC"=50 "TC") ///
("TI"=51 "TI") ///
("TJ"=52 "TJ") ///
("TU"=53 "TU") ///
("UC"=54 "UC") ///
("VC"=55 "VC") ///
("VD"=56 "VD") ///
("WB"=57 "WB") ///
("WO"=58 "WO") ///
("WV"=59 "WV") ///
("WW"=60 "WW") ///
("XB"=61 "XB") ///
("ZP"=62 "ZP") ///
, define(`1') replace casesensitive sub
qui count if `1'==.
if `pre_miss' == r(N) {
drop TMP
macro drop pre_miss
}
else {
fre TMP if `1'==.
drop TMP
macro drop pre_miss
error 181
}
end
capture program drop OW
program define OW
replace `1'=trim(`1')
gen TMP=`1'
count if `1'==""
local pre_miss = r(N)
strrec `1' ("Altri azionisti, in forma aggregata" "Other unnamed shar., agg." = 1 "Altri azionisti, in forma aggregata") ///
("Assicurazioni" "Insurance company" = 2 "Assicurazioni") ///
("Aziende industriale" "Industrial company" = 3 "Aziende industriale") ///
("Banche" "Bank" = 4 "Banche") ///
("Dipendenti /Dirigenti/Amministratori" "Employees/Managers" = 5 "Dipendenti/Dirigenti/Amministratori") ///
("Enti Pubblici, Stato, Governo" "State, Public authority" "Public" = 6 "Enti pubblici, stato, governo") ///
("Fondazioni/Istituti di Ricerca" "Foundation/Research Institute" = 7 "Fondazioni/Istituti di ricerca") ///
("Fondi Mutualistici & Pensionistici/Nominali/Fiduciari" "Mutual & Pension fund/Trust/Nominee" = 8 "Fondi mutualistici & pensionistici/nominali/fiduciari") ///
("La proprietà stessa" "Self-owned" = 9 "La proprietà stessa") ///
("Persone fisiche o famiglie" "Individual(s) or family(ies)" = 10 "Persone fisiche o famiglie") ///
("Private Equity firms" "Private equity firm" = 11 "Private equity firms") ///
("Società Finanziaria" "Financial company" = 12 "Società finanziaria") ///
("Società Quotate" = 13 "Società quotate") ///
("Venture capital" = 14 "Venture capital") ///
("Azionisti privati, in forma aggregata" "Unnamed private shareh., agg." = 15 "Azionisti privati, in forma aggregata") ///
("Società" = 16 "Società") ///
("Nave marittima" = 17 "Nave marittima") ///
("NA" = .a "n.a.") ///
, define(`1') replace casesensitive sub
qui count if `1'==.
if `pre_miss' == r(N) {
drop TMP
macro drop pre_miss
}
else {
fre TMP if `1'==.
drop TMP
macro drop pre_miss
error 181
}
end
capture program drop STATUS
program define STATUS
replace `1'=trim(`1')
replace `1'="" if inlist(`1',"-")
gen TMP=`1'
count if `1'==""
local pre_miss = r(N)
strrec `1' ("AR" = 1 "AR") ///
("AR+" = 2 "AR+") ///
, define(`1') replace casesensitive sub
qui count if `1'==.
if `pre_miss' == r(N) {
drop TMP
macro drop pre_miss
}
else {
fre TMP if `1'==.
drop TMP
macro drop pre_miss
error 181
}
end
/*** LABEL DEFINE SECTION ***/
capture label drop cod_prov
label define cod_prov 001 "Torino" ///
002 "Vercelli" ///
003 "Novara" ///
004 "Cuneo" ///
005 "Asti" ///
006 "Alessandria" ///
096 "Biella" ///
103 "Verbano-Cusio-Ossola" ///
007 "Aosta" ///
012 "Varese" ///
013 "Como" ///
014 "Sondrio" ///
015 "Milano" ///
016 "Bergamo" ///
017 "Brescia" ///
018 "Pavia" ///
019 "Cremona" ///
020 "Mantova" ///
097 "Lecco" ///
098 "Lodi" ///
021 "Bolzano" ///
022 "Trento" ///
023 "Verona" ///
024 "Vicenza" ///
025 "Belluno" ///
026 "Treviso" ///
027 "Venezia" ///
028 "Padova" ///
029 "Rovigo" ///
030 "Udine" ///
031 "Gorizia" ///
032 "Trieste" ///
093 "Pordenone" ///
008 "Imperia" ///
009 "Savona" ///
010 "Genova" ///
011 "La Spezia" ///
033 "Piacenza" ///
034 "Parma" ///
035 "Reggio Emilia" ///
036 "Modena" ///
037 "Bologna" ///
038 "Ferrara" ///
039 "Ravenna" ///
040 "Forlì - Cesena" ///
099 "Rimini" ///
045 "Massa Carrara" ///
046 "Lucca" ///
047 "Pistoia" ///
048 "Firenze" ///
049 "Livorno" ///
050 "Pisa" ///
051 "Arezzo" ///
052 "Siena" ///
053 "Grosseto" ///
100 "Prato" ///
054 "Perugia" ///
055 "Terni" ///
041 "Pesaro e Urbino" ///
042 "Ancona" ///
043 "Macerata" ///
044 "Ascoli Piceno" ///
056 "Viterbo" ///
057 "Rieti" ///
058 "Roma" ///
059 "Latina" ///
060 "Frosinone" ///
066 "L'aquila" ///
067 "Teramo" ///
068 "Pescara" ///
069 "Chieti" ///
070 "Campobasso" ///
094 "Isernia" ///
061 "Caserta" ///
062 "Benevento" ///
063 "Napoli" ///
064 "Avellino" ///
065 "Salerno" ///
071 "Foggia" ///
072 "Bari" ///
073 "Taranto" ///
074 "Brindisi" ///
075 "Lecce" ///
076 "Potenza" ///
077 "Matera" ///
078 "Cosenza" ///
079 "Catanzaro" ///
080 "Reggio Calabria" ///
101 "Crotone" ///
102 "Vibo Valentia" ///
081 "Trapani" ///
082 "Palermo" ///
083 "Messina" ///
084 "Agrigento" ///
085 "Caltanissetta" ///
086 "Enna" ///
087 "Catania" ///
088 "Ragusa" ///
089 "Siracusa" ///
090 "Sassari" ///
091 "Nuoro" ///
092 "Cagliari" ///
095 "Oristano" ///
104 "Olbia-Tempio" ///
105 "Ogliastra" ///
106 "Medio Campidano" ///
107 "Carbonia-Iglesias" ///
108 "Monza Brianza" ///
109 "Fermo" ///
110 "Barletta-Andria-Trani" ///
111 "Sud Sardegna"
capture label drop cod_reg
label define cod_reg 1 "Piemonte" ///
2 "Valle d'Aosta" ///
3 "Lombardia" ///
4 "Trentino-Alto Adige" ///
5 "Veneto" ///
6 "Friuli Venezia Giulia" ///
7 "Liguria" ///
8 "Emilia-Romagna" ///
9 "Toscana" ///
10 "Umbria" ///
11 "Marche" ///
12 "Lazio" ///
13 "Abruzzo" ///
14 "Molise" ///
15 "Campania" ///
16 "Puglia" ///
17 "Basilicata" ///
18 "Calabria" ///
20 "Sardegna" ///
19 "Sicilia" ///
21 "Estero"
capture label drop yesno
label define yesno 0 "No" 1 "Sì"
/*** END LABEL DEFINE SECTION ***/
capture label var rag_soc "Ragione Sociale"
capture label var anno "Anno"
capture confirm variable codfisca
if !_rc {
label var codfisca "Codice fiscale"
rename codfisca h15
**destring ??
}
capture confirm variable numcciaa
if !_rc {
label var numcciaa "Numero CCIAA"
rename numcciaa h03
}
capture confirm variable vat_number
if !_rc {
label var vat_number "Partita IVA"
rename vat_number h18
}
capture confirm variable bvdepid
if !_rc {
label var bvdepid "BvD ID number"
rename bvdepid cf32
}
capture confirm variable sd_isin
if !_rc label var sd_isin "ISIN number"
capture confirm variable sd_ticker
if !_rc label var sd_ticker "Ticker symbol"
capture confirm variable indirizz
if !_rc {
label var indirizz "Indirizzo"
replace indirizz=trim(indirizz)
rename indirizz h06
}
capture confirm variable codpost
if !_rc {
label var codpost "Codice Postale"
destring codpost, replace
rename codpost h07
}
capture confirm variable localita
if !_rc {
label var localita "Comune"
rename localita h08
}
capture confirm variable istatcom
if !_rc {
label var istatcom "Codice ISTAT comune"
capture confirm string variable istatcom
if !_rc {
destring istatcom, replace
}
recode istatcom (0=.)
rename istatcom vc_200078
}
capture confirm variable h08 vc_200078
if !_rc {
drop h08
}
capture confirm variable provinc
if !_rc {
label var provinc "Provincia"
rename provinc h09
}
capture confirm variable istatpro
if !_rc {
label var istatpro "Codice ISTAT provincia"
capture confirm string variable istatpro
if !_rc {
destring istatpro, replace
}
recode istatpro (0 999=.)
label values istatpro cod_prov
rename istatpro vc_200077
}
capture confirm variable h09 vc_200077
if !_rc {
drop h09
}
capture confirm variable regione
if !_rc {
label var regione "Provincia"
rename regione h10
}
capture confirm variable istatreg
if !_rc {
label var istatreg "Codice ISTAT regione"
capture confirm string variable istatreg
if !_rc {
destring istatreg, replace
}
recode istatreg (0 99=.)
label values istatreg cod_reg
rename istatreg vc_200076
}
capture confirm variable h10 vc_200076
if !_rc {
drop h10
}
capture confirm variable longitud
if !_rc {
label var longitud "Longitudine"
capture confirm string variable longitud
if !_rc {
destring longitud, replace
}