Announcement

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

  • Fama & French 12 industries classification in STATA

    Dear all,

    I want to translate SIC codes into the 12 industries classified by Fama and French.

    Does anyone know how to do it in STATA?

    I also find this code (url in link) but i didn't understand if it is for STATA and how to make it working.

    Thank you!

    Here it is the classification from French's website:

    1 NoDur Consumer NonDurables -- Food, Tobacco, Textiles, Apparel, Leather, Toys
    0100-0999
    2000-2399
    2700-2749
    2770-2799
    3100-3199
    3940-3989

    2 Durbl Consumer Durables -- Cars, TV's, Furniture, Household Appliances
    2500-2519
    2590-2599
    3630-3659
    3710-3711
    3714-3714
    3716-3716
    3750-3751
    3792-3792
    3900-3939
    3990-3999

    3 Manuf Manufacturing -- Machinery, Trucks, Planes, Off Furn, Paper, Com Printing
    2520-2589
    2600-2699
    2750-2769
    3000-3099
    3200-3569
    3580-3629
    3700-3709
    3712-3713
    3715-3715
    3717-3749
    3752-3791
    3793-3799
    3830-3839
    3860-3899

    4 Enrgy Oil, Gas, and Coal Extraction and Products
    1200-1399
    2900-2999

    5 Chems Chemicals and Allied Products
    2800-2829
    2840-2899

    6 BusEq Business Equipment -- Computers, Software, and Electronic Equipment
    3570-3579
    3660-3692
    3694-3699
    3810-3829
    7370-7379

    7 Telcm Telephone and Television Transmission
    4800-4899

    8 Utils Utilities
    4900-4949

    9 Shops Wholesale, Retail, and Some Services (Laundries, Repair Shops)
    5000-5999
    7200-7299
    7600-7699

    10 Hlth Healthcare, Medical Equipment, and Drugs
    2830-2839
    3693-3693
    3840-3859
    8000-8099

    11 Money Finance
    6000-6999

    12 Other Other -- Mines, Constr, BldMt, Trans, Hotels, Bus Serv, Entertainment

  • #2
    I'm sorry, the link didn't work. Here it is the file attached

    Thank you
    Attached Files

    Comment


    • #3
      Definitely not Stata code in that file.

      The task you face is tedious, but not at all difficult. It can be done with a long list of simple commands. You don't state whether the SIC code variable you already have is numeric (and formatted %04.0f) or a four character string variable. I'm going to assume the former--if it's the latter you can either -destring- it first, or put leading zeroes and quotes around all the corresponding numbers in the code below:

      Code:
      gen ff12_code = 12 // THE "OTHER" CATEGORY
      replace ff12_code = 1 if inrange(sic_code, 100, 999) | inrange(sic_code, 2000, 2399) | inrange(sic_code, 2700, 2749)  //... etc.
      // MORE ANNOYINGLY LONG COMMANDS LIKE THIS UNTIL YOU'RE DONE
      Familiarize yourself with the -inrange()- function, which works with both strings and numeric variables.

      You might well be able to paste the information from your original post into a do-file and go at it with some copy/paste and find/replace operations to turn it into the suggested code pretty quickly.

      Or, if you have, and know how to use, a good scripting language, or maybe Python, you might be able to write a script that generates the code I suggested above directly from a text file containing the same information you showed in your original post. But unless you are really good at that, or find it fun, it's probably not worth the effort for a list of this size. (For that matter, there are other Stata approaches, such as making a crosswalk data file out of the information in your original post, using -joinby- and -keep-. But again, the creation of the crosswalk file and coding and checking the rest is probably more work than just slogging through writing the code.)

      Comment


      • #4
        A program has already been written by Judson Caskey (now at UT Austin) for this exact purpose, additionally coding all of the industry categories 5, 10, 12, 17, 30, 38, 48 or 49.

        https://sites.google.com/site/judson...data/ffind.ado

        I've actually been using it since he was at UCLA. I modified the syntax slightly to use the "Generate" option rather than Judson's original "newvar" syntax, since I find it much more natural in the context of other stata commands, but other than that what I use is identical. Credit should go to Judson.
        Attached Files

        Comment


        • #5
          Hyejin: Please start a new thread when you have a new question.

          Comment

          Working...
          X