Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fama-French 48 Industrial Classifications

    Hello, I need help from respected members of statalist about creating 48 Industrial Classification of Fama French. I have a column for "SIC_Code" in my data. Next I want to create the 48 Industrial dummies based on the Fama-French (1997) industrial classification of these SIC Codes. How can I possibly programme it in STATA? For more clarity I paste a snapshot of how Fama French assigned two industries to the firm based on their SIC Codes. Thank you.
    Click image for larger version

Name:	sic.PNG
Views:	1
Size:	15.1 KB
ID:	1349106

  • #2
    http://www.statalist.org/forums/foru...tion-need-help

    Comment


    • #3
      thank you. i used this link (http://faculty-gsb.stanford.edu/deHa...tries_ff48.txt) to learn how to programme for creating 48 industries. But honestly I did not understand how he did this programming also i got lot of errors when i tried to follow his steps.

      Comment


      • #4
        I'm not sure what your link provides - I cannot access it - but I note that the link provided in post #3 of the thread referred to by Nick Cox has apparently been relocated to http://kaikaichen.com/?p=294 at this time, in case you were unable to find it.

        Comment


        • #5
          i retrieved the programming guidance from here (http://mba.tuck.dartmouth.edu/pages/...a_library.html) if you scroll down you will see the programming for creating 48 industry portfolio. i could not really understand the coding procedure from there. also got lot of errors when i tried to.
          i would be thankful if someone could explain me it in simple non-technical language or any coding to do that will also be welcomed. thank you.

          Comment


          • #6
            if you scroll down you will see the programming for creating 48 industry portfolio
            Well, I can't see it. There is nothing on that page that looks like a program, and none of the links on that page include the words "program" or "Stata." I think you'll have to be much more specific about the code you want explained. Perhaps post it here (if that doesn't violate any copyrights).

            Comment


            • #7
              Have you reviewed the material at the link in post #4? It describes software that appears to do what you want withour requiring programming.

              Comment


              • #8
                The web links for this keeps on moving. I am unable to attach the doc file with the codes so I am pasting all of them here. apologies for such a long post. also i am showing for only two industries due to limited space and word limit here. the procedure can be repeated for rest of 46 industries in the same way. the problem is i cannot really understand how the author has done this coding procedure. any easier way out to perform this procedure will be welcome. thank you.


                option errorabend;
                *option merror mlogic mprint symbolgen;
                option nonotes nosource nosource2;
                *option notes source source2;
                *option logic print symbolgen;

                /************************************************** ******************************
                Author: Ed deHaan, derived from work of unknown authors

                Macro: ind_ff48

                Purpose: to assign Fama French industry codes

                Versions: 1.0 - 7/21/10 - original version
                1.1 - 11/19/10 - redid all codes based on updated FF classification


                Notes: 48 Industry classification codes obtained from French's website in Nov. 2010
                http://mba.tuck.dartmouth.edu/pages/...a_library.html


                --------------------------------------------

                Generates Fama-French industry codes based on four-digit SIC codes.


                Outputs the original dataset with appended industry code information:

                '&ind_code' = count variable of industry codes from 1 through 48
                'FF_IND' = text variable with name of the fama-french industry
                '&bin_var.#' = 48 individual binary variables, one for each industry
                '_&global' = global macro variable to include call 48 industry dummies

                --------------------------------------------


                Required INPUT parameters:
                dset - input dataset name
                sic - four-digit sic code variable name
                outp - output dataset
                bin_var - prefix for industry binary variables
                ind_code - name of count variable for industry codes 1 through 48
                global - name of global macro variable to call all 48 industry dummies

                Optional INPUT parameters





                ************************************************** ******************************/


                %let _industry_fe= i1 i2 i3 i4 i5 i6 i7 i8 i9
                i10 i11 i12 i13 i14 i15 i16 i17 i18 i19
                i20 i21 i22 i23 i24 i25 i26 i27 i28 i29
                i30 i31 i32 i33 i34 i35 i36 i37 i38 i39
                i40 i41 i42 i43 i44 i45 i46 i47 i48;

                %macro ind_ff48 (dset, outp, sic, bin_var, ind_code );

                ********** FF Ind Codes Macro **********;



                data &outp;
                set &dset;

                indus2=int(&sic/100);
                indus3=int(&sic/10);

                * 1 Agric Agriculture;
                if &sic ge 0100 and &sic le 0199 then FF_IND='AGRIC';
                if &sic ge 0200 and &sic le 0299 then FF_IND='AGRIC';
                if &sic ge 0700 and &sic le 0799 then FF_IND='AGRIC';
                if &sic ge 0910 and &sic le 0919 then FF_IND='AGRIC';
                if &sic ge 2048 and &sic le 2048 then FF_IND='AGRIC';
                if FF_IND='AGRIC' then &ind_code=1;

                * 2 Food Food Products;
                if &sic ge 2000 and &sic le 2009 then FF_IND='FOOD';
                if &sic ge 2010 and &sic le 2019 then FF_IND='FOOD';
                if &sic ge 2020 and &sic le 2029 then FF_IND='FOOD';
                if &sic ge 2030 and &sic le 2039 then FF_IND='FOOD';
                if &sic ge 2040 and &sic le 2046 then FF_IND='FOOD';
                if &sic ge 2050 and &sic le 2059 then FF_IND='FOOD';
                if &sic ge 2060 and &sic le 2063 then FF_IND='FOOD';
                if &sic ge 2070 and &sic le 2079 then FF_IND='FOOD';
                if &sic ge 2090 and &sic le 2092 then FF_IND='FOOD';
                if &sic ge 2095 and &sic le 2095 then FF_IND='FOOD';
                if &sic ge 2098 and &sic le 2099 then FF_IND='FOOD';
                if FF_IND='FOOD' then &ind_code=2


                if(&ind_code=1) then &bin_var.1=1; else &bin_var.1=0;
                if(&ind_code=2) then &bin_var.2=1; else &bin_var.2=0;
                if(&ind_code=3) then &bin_var.3=1; else &bin_var.3=0;
                if(&ind_code=4) then &bin_var.4=1; else &bin_var.4=0;
                if(&ind_code=5) then &bin_var.5=1; else &bin_var.5=0;
                if(&ind_code=6) then &bin_var.6=1; else &bin_var.6=0;
                if(&ind_code=7) then &bin_var.7=1; else &bin_var.7=0;
                if(&ind_code=8) then &bin_var.8=1; else &bin_var.8=0;
                if(&ind_code=9) then &bin_var.9=1; else &bin_var.9=0;
                if(&ind_code=10) then &bin_var.10=1; else &bin_var.10=0;
                if(&ind_code=11) then &bin_var.11=1; else &bin_var.11=0;
                if(&ind_code=12) then &bin_var.12=1; else &bin_var.12=0;
                if(&ind_code=13) then &bin_var.13=1; else &bin_var.13=0;
                if(&ind_code=14) then &bin_var.14=1; else &bin_var.14=0;
                if(&ind_code=15) then &bin_var.15=1; else &bin_var.15=0;
                if(&ind_code=16) then &bin_var.16=1; else &bin_var.16=0;
                if(&ind_code=17) then &bin_var.17=1; else &bin_var.17=0;
                if(&ind_code=18) then &bin_var.18=1; else &bin_var.18=0;
                if(&ind_code=19) then &bin_var.19=1; else &bin_var.19=0;
                if(&ind_code=20) then &bin_var.20=1; else &bin_var.20=0;
                if(&ind_code=21) then &bin_var.21=1; else &bin_var.21=0;
                if(&ind_code=22) then &bin_var.22=1; else &bin_var.22=0;
                if(&ind_code=23) then &bin_var.23=1; else &bin_var.23=0;
                if(&ind_code=24) then &bin_var.24=1; else &bin_var.24=0;
                if(&ind_code=25) then &bin_var.25=1; else &bin_var.25=0;
                if(&ind_code=26) then &bin_var.26=1; else &bin_var.26=0;
                if(&ind_code=27) then &bin_var.27=1; else &bin_var.27=0;
                if(&ind_code=28) then &bin_var.28=1; else &bin_var.28=0;
                if(&ind_code=29) then &bin_var.29=1; else &bin_var.29=0;
                if(&ind_code=30) then &bin_var.30=1; else &bin_var.30=0;
                if(&ind_code=31) then &bin_var.31=1; else &bin_var.31=0;
                if(&ind_code=32) then &bin_var.32=1; else &bin_var.32=0;
                if(&ind_code=33) then &bin_var.33=1; else &bin_var.33=0;
                if(&ind_code=34) then &bin_var.34=1; else &bin_var.34=0;
                if(&ind_code=35) then &bin_var.35=1; else &bin_var.35=0;
                if(&ind_code=36) then &bin_var.36=1; else &bin_var.36=0;
                if(&ind_code=37) then &bin_var.37=1; else &bin_var.37=0;
                if(&ind_code=38) then &bin_var.38=1; else &bin_var.38=0;
                if(&ind_code=39) then &bin_var.39=1; else &bin_var.39=0;
                if(&ind_code=40) then &bin_var.40=1; else &bin_var.40=0;
                if(&ind_code=41) then &bin_var.41=1; else &bin_var.41=0;
                if(&ind_code=42) then &bin_var.42=1; else &bin_var.42=0;
                if(&ind_code=43) then &bin_var.43=1; else &bin_var.43=0;
                if(&ind_code=44) then &bin_var.44=1; else &bin_var.44=0;
                if(&ind_code=45) then &bin_var.45=1; else &bin_var.45=0;
                if(&ind_code=46) then &bin_var.46=1; else &bin_var.46=0;
                if(&ind_code=47) then &bin_var.47=1; else &bin_var.47=0;
                if(&ind_code=48) then &bin_var.48=1; else &bin_var.48=0;

                run;


                %mend;

                option notes source source2;

                Comment


                • #9
                  This isn't Stata code. I think it's SAS code written by programmers paid by the line, although I am happy for my ignorance to be exposed there. But if this is the solution it is easy enough for you to write a Stata do file for the job. But you must tell us enough about your existing data, especially variable names, storage types and typical values, for us to give a start.

                  Please read and act on

                  http://www.statalist.org/forums/help#stata

                  and in passing please also read

                  http://www.statalist.org/forums/help#references

                  http://www.statalist.org/forums/help#spelling

                  Comment

                  Working...
                  X