libname g350 "c:\sasdat\g350"; options linesize=80; *Read in the raw data; ************************; data g350.zdata(compress=yes); infile "c:\sasdat\g350\zolnik.csv" delimiter="," missover; length country $ 10; length metro $ 50; input code country metro ahi96 cr96 ea96 imr96 la96 o96 p96 t96 ur96 ahi91 cr91 imr91 p91; label ahi96="Average household income US$ 1996"; label cr96="Violent and property crime per 100,000 pop 1996"; label ea96="Share of Pop 25+ with Bachelor's Degrees 1996"; label imr96="Infant deaths per 1,000 live births 1996"; label la96="Land Area square kilometers 1996"; label o96="Second daily max one-hour Ozone, ppm 1996"; label p96="Total population 1996"; label t96="Homeownership rate 1996"; label ur96="Civilian unemployment rate 1996"; label ahi91="Average household income US$ 1991"; label cr91="Violent and property crime per 100,000 pop 1991"; label imr91="Infant deaths per 1,000 live births 1991"; label p91="Total population 1991"; den96=p96/la96; label den96="Population per sq km 1996"; inchg=((ahi96-ahi91)/ahi91)*100; label inchg="Percentage change in average household income"; crchg=cr96-cr91; label crchg="Change in crime rate"; imchg=imr96-imr91; label imchg="Change in Infant Mortality Rate"; ppchg=((p96-p91)/p91)*100; label ppchg="Percent change in total population"; run; proc discrim data=g350.zdata out=g350.discout crosslisterr; class country; id metro; title "Simple Illustration of Discriminant Analysis"; var ur96 o96; run; proc means data=g350.zdata; class country; var ahi96 cr96 ea96 imr96 o96 p96 t96 ur96 ahi91 cr91 imr91 p91 den96 inchg crchg imchg ppchg; run; proc stdize data=g350.zdata method=std out=g350.zstand; var ahi96 cr96 ea96 imr96 la96 o96 p96 t96 ur96 ahi91 cr91 imr91 p91 den96 inchg crchg imchg ppchg; run; proc candisc data=g350.zstand; class country; var ahi96 cr96 crchg ea96 imr96 imchg o96 ppchg t96 ur96 den96; run; proc stepdisc data=g350.zstand; class country; var ahi96 cr96 ea96 imr96 la96 o96 p96 t96 ur96 ahi91 cr91 imr91 p91 den96 inchg crchg imchg ppchg; run; proc discrim data=g350.zstand out=g350.disc1 crosslist; class country; id metro; var ahi96 t96 ea96; Title "Income, Tenure, and Education"; run; proc discrim data=g350.zstand out=g350.disc2 crosslist; class country; id metro; var cr96 crchg imr96 imchg; Title "Crime Rates and Infant Mortality"; run; proc discrim data=g350.zstand out=g350.disc2 crosslist; class country; id metro; var den96 ppchg; Title "Density and Population Change"; run;