Dear Stata users,
I have been struggling to convert my sic code into the 12 industries classified by Fama and French. I have encoded my sic code into a numeric variable :
* Example generated by -dataex-. To install: ssc install dataex
clear
input long sic str4 SIC
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
287 "5080"
189 "3661"
189 "3661"
189 "3661"
189 "3661"
189 "3661"
226 "3844"
226 "3844"
226 "3844"
89 "2834"
89 "2834"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
248 "4512"
264 "4922"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
165 "3564"
219 "3825"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
373 "6799"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
192 "3670"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
263 "4911"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
385 "7359"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
89 "2834"
70 "2621"
end
label values sic sic_code
label def sic_code 70 "2621", modify
label def sic_code 89 "2834", modify
label def sic_code 165 "3564", modify
label def sic_code 189 "3661", modify
label def sic_code 192 "3670", modify
label def sic_code 219 "3825", modify
label def sic_code 226 "3844", modify
label def sic_code 248 "4512", modify
label def sic_code 263 "4911", modify
label def sic_code 264 "4922", modify
label def sic_code 287 "5080", modify
label def sic_code 373 "6799", modify
label def sic_code 385 "7359", modify
[/CODE]
However when typing in the following code
Code:
gen ff_12= 1 if (sic>=100 & sic<=999)|(sic>=2000 & sic<=2399)|(sic>=2700 & sic<=2749)|(sic>=2770 & sic<=2779)|(sic>=3100 & sic<=3199)|(sic>=3940 & sic<=3989) replace ff_12 = 2 if (sic>=2500 & sic<=2519)|(sic>=2590 & sic<=2599)|(sic>=3630 & sic<=3659)|(sic==3710) | (sic==3711) | (sic==3714) | (sic==3716) | (sic==3750) | (sic==3751) | (sic==3792)|(sic>=3900 & sic<=3939)|(sic>=3990 & sic<=3999) replace ff_12= 3 if (sic>=2520 & sic<=2589)|(sic>=2600 & sic<=2699)|(sic>=2750 & sic<=2769)|(sic>=3000 & sic<=3099)|(sic>=3200 & sic<=3569)|(sic>=3580 & sic<=3629)|(sic>=3700 & sic<=3709)| (sic==3712) | (sic==3713) | (sic==3715)|(sic>=3717 & sic<=3749)|(sic>=3752 & sic<=3791)|(sic>=3793 & sic<=3799)|(sic>=3830 & sic<=3839)|(sic>=3860 & sic<=3899) replace ff_12= 4 if (sic>=1200 & sic<=1399)|(sic>=2900 & sic<=2999) replace ff_12= 5 if (sic>=2800 & sic<=2829)|(sic>=2840 & sic<=2899) replace ff_12= 6 if (sic>=3570 & sic<=3579)|(sic>=3660 & sic<=3692)|(sic>=3694 & sic<=3699)|(sic>=3810 & sic<=3829)|(sic>=7370 & sic<=7379) replace ff_12= 7 if (sic>=4800 & sic<=4899) replace ff_12= 8 if (sic>=4900 & sic<=4949) replace ff_12= 9 if (sic>=5000 & sic<=5999)|(sic>=7200 & sic<=7299)|(sic>=7600 & sic<=7699) replace ff_12= 10 if (sic>=2830 & sic<=2839)|(sic==3693)|(sic>=3840 & sic<=3859)|(sic>=8000 & sic<=8099) replace ff_12= 11 if (sic>=6000 & sic<=6999) replace ff_12= 12 if ff_12==. Stata displays that 0 real changes have been made between the 2nd to the 11th industry codes only classifying the 1st and last industry sic codes. Afterwards, I tried to make sense of the file I attached to this post but I found it very difficult to navigate and ultimately leading to none of my sic codes being translated into the industry classes. I tried to download the help file but it does not open after I download it with a message saying "The Help for this program was created in Windows Help format, which depends on a feature that isn't included in Windows 8.1 or Windows RT 8.1". I have been really struggling with this and I would really appreciate if someone can aid me with this pressing issue. Thanks in advance, Alli (Mr)
Related Posts with Fama and French industry classifications
what's going wrong with my msm for logit fixed effectsDear statalists: I want to use maximum simulation method to estimate a logit with fixed effects,but …
insheeting excel files using loop and extracting filename as variable valueHello, I am trying to use insheet multiple .xlxs files and then extract filename. This is my code: …
Difference-in-Differences derivationHi everyone, I am aware that this forum is in particular for questions regarding Stata but my quest…
File not found errorI'm trying to importing several files from a folder using this code: cd "\\xyz" local aaa: dir . fi…
Interacting firm fixed effects for numerous firms with a continuous variable - Execution and interpretationDear all, I am attempting to replicate a series of OLS regressions with respect to the effect of CE…
Subscribe to:
Post Comments (Atom)
0 Response to Fama and French industry classifications
Post a Comment