Friday, July 22, 2011

Converting from 4-Digit SIC to 2-Digit SIC

Table 4 of "The power of the pen and executive compensation" (Core, Guay, and Larcker 2008) contains "fixed effects for year and 2-digit SIC codes." But ExecuComp in WRDS gives you the 4-digit SIC codes. How do you get from 4 digits to 2 in SAS?


First, note that the first two digits denote the "major industry group." Second, 4-digit SIC from ExecuComp is unsurprisingly numeric. So substr won't work unless you first convert from numeric to string:


sictwo=put(sic,4.0)


Then you can use substr. Just be sure to convert it back to numeric:


sictwo=input(sictwo,best4.)


Now run your fixed effects regression.