/*This program reads in dividends and end-of-year price on the firms in the DJIA in order to calculate the dividend yield on the index; the input data are produced by the Wharton internet program that pulls requested data out of COMPUSTAT (internet address: http://wrds.wharton.upenn.edu and go to compustat--advanced query. For the file of company sumbols, select c:\sas\symbols.txt -- it contains all the companies currently in DJIA. The programs reads in dividends and share buybacks for the DJIA files and calculates the dividend yield and the adjusted dividend yield*/ libname datalib '/tmp/'; filename djfile '/tmp/div.txt'; data all(drop=cnum); infile djfile; input cnum $ year smbl $ div repurch issues shrout price; adjdps=(div+issues-repurch)/shrout; *adjusted dividend per share; run; *calculate the statistics for the DJIA for given years; data DJ1950; *only start in 1950 when COMPUSTAT data become available; set all; *I have not found the symbol for "american tobacco", so I use McD instead; *I have also not found Anaconda, and use Minnesota mining instead; if year>1949 and year<1956; if smbl in ("NS" "ALD" "JM" "T" "N" "NAV" "WX.F" "OI" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "C." "GT" "IP" "BS" "MCD" "CPO" "UK" "MMM" "PA2" "M01" "PG" "SRD" "UTX" "2830B" "MROX.CM"); proc sort; by year; run; proc means noprint nway data=DJ1950; by year; var adjdps price; output out=div1950 mean=madjdps mprice N=num_obs; run; data DJ1959; *only start in 1950 when COMPUSTAT data become available; set all; *I have not found the symbol for "american tobacco", so I use McD instead; *I have also not found Anaconda, and use Minnesota mining instead; if year>1958 and year<1979; if smbl in ("AA" "ALD" "JM" "T" "N" "NAV" "WX.F" "OI" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "C." "GT" "IP" "BS" "MCD" "ESM" "UK" "MMM" "PA2" "M01" "PG" "SRD" "UTX" "2830B" "MROX.CM"); proc sort; by year; run; proc means noprint nway data=DJ1959; by year; var adjdps price; output out=div1959 mean=madjdps mprice N=num_obs; run; data DJ1979; set all; if year>1978 and year<1985; if smbl in ("AA" "ALD" "JM" "T" "N" "NAV" "WX.F" "OI" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "IBM" "GT" "IP" "BS" "MCD" "MRK" "UK" "MMM" "PA2" "M01" "PG" "SRD" "UTX" "2830B" "MROX.CM"); proc sort; by year; run; proc means noprint nway data=DJ1979; by year; var adjdps price; output out=div1979 mean=madjdps mprice N=num_obs; run; *changes in 1985; data DJ1985; set all; if year>1984 and year<1987; if smbl in ("AA" "ALD" "JM" "T" "N" "NAV" "WX.F" "OI" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "IBM" "GT" "IP" "BS" "MCD" "MRK" "UK" "MMM" "PA2" "MO" "PG" "SRD" "UTX" "2830B" "MROX.CM"); proc sort; by year; run; proc means noprint nway data=DJ1985; by year; var adjdps price; output out=div1985 mean=madjdps mprice N=num_obs; run; *changes in 1987; data DJ1987; set all; if year>1986 and year<1991; if smbl in ("AA" "ALD" "JM" "T" "BA" "NAV" "WX.F" "KO" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "IBM" "GT" "IP" "BS" "MCD" "MRK" "UK" "MMM" "PA2" "MO" "PG" "SRD" "UTX" "2830B" "MROX.CM"); proc sort; by year; run; proc means noprint nway data=DJ1987; by year; var adjdps price; output out=div1987 mean=madjdps mprice N=num_obs; run; *changes in 1991; data DJ1991; set all; if year>1990 and year<1997; if smbl in ("AA" "ALD" "JM" "T" "BA" "CAT" "WX.F" "KO" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "IBM" "GT" "IP" "BS" "MCD" "MRK" "UK" "MMM" "JPM" "MO" "PG" "SRD" "UTX" "2830B" "DIS"); proc sort; by year; run; proc means noprint nway data=DJ1991; by year; var adjdps price; output out=div1991 mean=madjdps mprice N=num_obs; run; *changes in 1997; data DJ1997; set all; if year>1996; if smbl in ("AA" "ALD" "JM" "T" "BA" "CAT" "C" "KO" "DD" "EK" "XOM" "GE" "GM" "TX" "S" "IBM" "GT" "IP" "JNJ" "MCD" "MRK" "UK" "MMM" "JPM" "MO" "PG" "SRD" "UTX" "WMT" "DIS"); proc sort; by year; run; proc means noprint nway data=DJ1997; by year; var adjdps price; output out=div1997 mean=madjdps mprice N=num_obs; run; data datalib.DJyild; set div1950 div1959 div1979 div1985 div1987 div1991 div1997; *calculate the dps and dyield adjusted for divisors; *set up the divisor as the last divisor in that year; if year=1950 then divisor=7.54; else if year=1951 then divisor=6.53; else if year=1952 then divisor=6.16; else if year=1953 then divisor=6.16; else if year=1954 then divisor=5.89; else if year=1955 then divisor=5.11; else if year=1956 then divisor=4.566; else if year=1957 then divisor=4.283; else if year=1958 then divisor=4.283; else if year=1959 then divisor=3.824; else if year=1960 then divisor=3.28; else if year=1961 then divisor=3.09; else if year=1962 then divisor=2.988; else if year=1963 then divisor=2.876; else if year=1964 then divisor=2.615; else if year=1965 then divisor=2.245; else if year=1966 then divisor=2.245; else if year=1967 then divisor=2.163; else if year=1968 then divisor=2.078; else if year=1969 then divisor=1.894; else if year=1970 then divisor=1.826; else if year=1971 then divisor=1.661; else if year=1972 then divisor=1.661; else if year=1973 then divisor=1.626; else if year=1974 then divisor=1.598; else if year=1975 then divisor=1.588; else if year=1976 then divisor=1.504; else if year=1977 then divisor=1.443; else if year=1978 then divisor=1.443; else if year=1979 then divisor=1.465; else if year=1980 then divisor=1.465; else if year=1981 then divisor=1.314; else if year=1982 then divisor=1.359; else if year=1983 then divisor=1.230; else if year=1984 then divisor=1.132; else if year=1985 then divisor=1.090; else if year=1986 then divisor=.889; else if year=1987 then divisor=.754; else if year=1988 then divisor=.7; else if year=1989 then divisor=.586; else if year=1990 then divisor=.505; else if year=1991 then divisor=.559; else if year=1992 then divisor=.46268499; else if year=1993 then divisor=.4473; else if year=1994 then divisor=.3715; else if year=1995 then divisor=.34599543; else if year=1996 then divisor=.32514559; else if year=1997 then divisor=.25089315; else if year=1998 then divisor=.24275214; iprice=mprice/divisor; iadjdps=madjdps/divisor; iadjdyld=iadjdps/iprice; run; data _null_; set datalib.DJyild; file dyld; put @2 year 4. +2 iadjdyld 8.6 +2 iadjdps 9.6; run;