** Shingles Data Set (NKNW 8.9 & 10.14); OPTIONS LINESIZE=75 NOCENTER NONUMBER NODATE; * OPTIONS PAGESIZE = 20; /* for sizing output for LaTeX slides */ TITLE 'Roofing Shingle Sales'; PROC IMPORT DATAFILE = 'C:\Documents and Settings\Mark Irwin\My Documents\Harvard\Courses\Stat 135\Autumn 2005\SAS\Shingles.txt' DBMS = dlm OUT = shingles REPLACE; PROC FORMAT; VALUE $trainfmt 'TRUE' = 'Training' 'FALSE' = 'Test'; VALUE potfmt 1 = 'Low' 2 = 'Moderate' 3 = 'High' . = 'Missing' OTHER = 'Miscoded'; VALUE competefmt LOW-<10 = 'Low' 10-HIGH = 'High'; DATA shingles2; set shingles; FORMAT potentcat $8. training $5. compete $4.; compete = put(brands,competefmt.); IF potential > 15 then potentcat = 'High'; ELSE IF potential < 6 then potentcat = 'Low'; ELSE potentcat = 'Moderate'; IF potential > 15 then pot = 3; ELSE IF potential < 6 then pot = 1; ELSE pot = 2; IF _N_ < 27 THEN training = 'TRUE'; ELSE training = 'FALSE'; obsno = _N_; RUN; PROC REG DATA=shingles; VAR promotion accounts brands potential; simple_ex: MODEL sales = promotion accounts; simple_all: MODEL sales = promotion accounts / ALL; simple_select: MODEL sales = promotion accounts / COLLIN INFLUENCE; simple_ex: MODEL sales = promotion accounts; RUN; ADD potential; PRINT ANOVA; RUN; PROC REG DATA=shingles OUTEST=shinglereg; VAR promotion accounts brands potential; simple_ex: MODEL sales = promotion accounts; RUN; PROC GLM DATA = shingles2; CLASS potentcat training; MODEL sales = potentcat * training; RUN; PROC GLM DATA = shingles2; CLASS potentcat training; MODEL sales = potentcat training potentcat * training; RUN; PROC GLM DATA = shingles2; CLASS potentcat; MODEL sales = potentcat accounts brands; RUN; PROC GLM DATA = shingles2; CLASS potentcat; MODEL sales = potentcat accounts brands / SOLUTION; RUN; PROC GLM DATA = shingles2; CLASS potentcat; MODEL sales = potentcat accounts brands / NOINT SOLUTION; RUN; PROC GLM DATA = shingles2; MODEL sales = accounts brands / CLPARM ; ESTIMATE 'Accounts = 10, Brands = 7' intercept 1 accounts 10 brands 7; RUN; PROC GLM DATA = shingles2; CLASS potentcat; MODEL sales = potentcat accounts brands / SOLUTION; ESTIMATE 'High - 15 - 10' intercept 1 potentcat 1 0 0 accounts 15 brands 10; ESTIMATE 'Low - 15 - 10' intercept 1 potentcat 0 1 0 accounts 15 brands 10; ESTIMATE 'Moderate - 15 - 10' intercept 1 potentcat 0 0 1 accounts 15 brands 10; ESTIMATE 'High vs Low' potentcat 1 -1 0; ESTIMATE 'Problem' potentcat 0 0 1 accounts 15 brands 10; CONTRAST 'High vs Low' potentcat 1 -1 0; CONTRAST 'High vs Moderate' potentcat 1 0 -1; CONTRAST 'Moderate vs Low' potentcat 0 -1 1; RUN; QUIT;