/* SAS Example 4a: Discriminant Analysis on HATCO data */ /* Dependent Variable: X11 */ OPTIONS PS=54; OPTIONS LS=78; OPTIONS NODATE; OPTIONS PAGENO=1; /* We will first perform a discriminant analysis on the analysis sample */ DATA PERCEPTION; INFILE 'A:/HATCO2.TXT'; INPUT X1-X14; LABEL X1 = 'Delivery Speed'; LABEL X2 = 'Price Level'; LABEL X3 = 'Price Flexibility'; LABEL X4 = 'Manufacturer Image'; LABEL X5 = 'Service'; LABEL X6 = 'Salesforce Image'; LABEL X7 = 'Product Quality'; LABEL X8 = 'Firm Size'; LABEL X9 = 'Usage Level'; LABEL X10 = 'Satisfaction Level'; LABEL X11 = 'Specification Buying'; LABEL X12 = 'Structure of Procurement'; LABEL X13 = 'Type of Industry'; LABEL X14 = 'Type of Buying Situation'; RUN; /* Before performing the discriminant analysis, we should have an idea of which variables differentiate most between the levels of X11. This is accomplished in two stages: Firstly we will examine the means of the different levels over the seven perception variables (which will involve sorting the data before running PROC MEANS. Then we will print ANOVA tables to see which of the differences are significant. */ PROC SORT; BY X11; RUN; PROC MEANS; CLASS X11; VAR X1-X7; RUN; PROC GLM; CLASS X11; MODEL X1-X7=X11; RUN; /* We will perform the discriminant analysis on the classification variable X11, using explanatory variables X3 and X7. This choice of explanatory variables was the result of a performing a stepwise search procedure (by hand). The PRIORS PROPORTIONAL statement sets the probabilities of group membership proportional to the sample sizes */ PROC DISCRIM METHOD=NORMAL POOL=YES MANOVA LIST; CLASS X11; PRIORS PROPORTIONAL; VAR X3 X7; RUN; /* We will now check our classification functions on our holdout sample. We will calculate the classification function for each group and the observations will be classified into the group that results in the largest value. */ DATA HOLDOUT; INFILE 'A:/HATCO3.TXT'; INPUT X1-X14; LABEL X1 = 'Delivery Speed'; LABEL X2 = 'Price Level'; LABEL X3 = 'Price Flexibility'; LABEL X4 = 'Manufacturer Image'; LABEL X5 = 'Service'; LABEL X6 = 'Salesforce Image'; LABEL X7 = 'Product Quality'; LABEL X8 = 'Firm Size'; LABEL X9 = 'Usage Level'; LABEL X10 = 'Satisfaction Level'; LABEL X11 = 'Specification Buying'; LABEL X12 = 'Structure of Procurement'; LABEL X13 = 'Type of Industry'; LABEL X14 = 'Type of Buying Situation'; Z0 = -51.66546 + 8.25616*X3 + 5.49035*X7; Z1 = -60.42779 + 10.94608*X3 + 3.81958*X7; IF Z0 > Z1 THEN Z = 0; IF Z1 > Z0 THEN Z = 1; RUN; /* This PROC PRINT will allow us to examine any misclassifications */ PROC PRINT; VAR X1-X7 X11 Z; RUN; /* We can also print a classification table for our holdout sample */ PROC FREQ; TABLE Z*X11; RUN;