* Condo Example See pages 447 to 465 of the Mendenhall and Sincich textbook. Examine 4 regression models for predicting sale prices of condo units at auction; /* data condo; infile "c:/datasets/condo.txt" dsd dlm='09x' firstobs=2; input PRICE100 FLOOR DIST VIEW END FURNISH SOLD $; drop SOLD; */ * proc import is simpler that using an infile statement for inputing tab delimited data; options ls=70 nodate pageno=1; proc import datafile="c:/datasets/condo.txt" out=condo replace; * Set up quadratic and interaction terms; data condo2; set condo; FLR_FLR = FLOOR * FLOOR; DST_DST = DIST * DIST; FLR_DST = FLOOR * DIST; FLR_VIEW = FLOOR * VIEW; DST_VIEW = DIST*VIEW; FLR_FLR_VIEW = FLOOR * FLOOR * VIEW; DST_DST_VIEW = DIST * DIST * VIEW; FLR_DST_VIEW = FLOOR * DIST * VIEW; proc reg data=condo2; title "Model 1: All Linear Terms"; model PRICE100 = FLOOR DIST VIEW END FURNISH; proc reg data=condo2; title "Model 2: Full Quadratic for Floor and Distance"; model PRICE100 = FLOOR DIST VIEW END FURNISH FLR_FLR DST_DST FLR_DST; Second_Order: test FLR_FLR = 0, DST_DST = 0, FLR_DST = 0; proc reg data=condo2; title "Model 3: Include Interactions of Quadratic Model with View"; model PRICE100 = FLOOR DIST FLR_FLR DST_DST FLR_DST VIEW END FURNISH FLR_VIEW DST_VIEW FLR_FLR_VIEW DST_DST_VIEW FLR_DST_VIEW; View_Interact: test FLR_VIEW = 0, DST_VIEW = 0, FLR_FLR_VIEW = 0, DST_DST_VIEW = 0, FLR_DST_VIEW = 0; * Use proc glm because setting up interactions and dummy variables is easier than it is for proc reg; proc glm data=condo; title "Model 4: Same as Model 3, but change FLOOR to factor with 8 levels"; class FLOOR; model PRICE100 = FLOOR DIST DIST*DIST FLOOR*DIST VIEW END FURNISH FLOOR*VIEW DIST*VIEW DIST*DIST*VIEW FLOOR*DIST*VIEW DIST*DIST*FLOOR; * The test statement is omitted because does not work with proc glm; run; quit;