** Shingles Data Set (NKNW 8.9 & 10.14); OPTIONS LINESIZE=75 NOCENTER PAGENO=1; TITLE 'Roofing Shingle Sales'; PROC IMPORT DATAFILE = 'F:\Autumn 2005\SAS\Shingles.txt' DBMS = dlm OUT = shingles REPLACE; PROC PRINT DATA = shingles; DATA shingles2; set shingles; value = sales * 51.25; /* assuming $51.25 per 1000 squares */ IF brands < 10 THEN compete = 'low'; ELSE compete = 'hi'; SELECT; WHEN (0 LE potential LT 5) grade = 0; WHEN (5 LE potential LT 10) grade = 1; WHEN (10 LE potential LT 15) grade = 2; WHEN (15 LE potential LT 20) grade = 3; WHEN (potential GE 20) grade = 4; END; IF grade in (0, 1) THEN pass = 'F'; ELSE pass = 'T'; 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 PRINT DATA = shingles2; DATA shingles3; SET shingles2; IF _N_ < 6; /* ok since _N_ is a integer variable starting at 1 */ DATA shingles4; SET shingles2; IF _N_ > 5 THEN DELETE; PROC PRINT DATA = shingles3; TITLE 'shingles3 version'; PROC PRINT DATA = shingles4; TITLE 'shingles4 version'; RUN; PROC SORT DATA = shingles2 OUT = shingles5; BY sales; PROC PRINT DATA = shingles5; TITLE 'Increasing in Sales'; VAR sales promotion accounts brands potential; PROC SORT DATA = shingles2; BY DESCENDING sales; PROC PRINT DATA = shingles2; TITLE 'Decreasing in Sales'; VAR sales promotion accounts brands potential; PROC MEANS DATA = shingles; TITLE 'PROC MEANS Output of Roofing Shingle Sales'; TITLE2 'Default Output'; VAR sales promotion accounts brands potential; PROC MEANS DATA = shingles MEAN STD MIN Q1 MEDIAN Q3 MAX CLM PROBT T /* statistics */ ALPHA = 0.01 FW = 8; /* options */ TITLE 'PROC MEANS Output of Roofing Shingle Sales'; TITLE2 'Statistics Selected'; VAR sales promotion accounts brands potential; PROC UNIVARIATE DATA = shingles NORMAL CIBASIC PLOTS ALPHA = 0.01; VAR sales; HISTOGRAM sales; QQPLOT sales; PROBPLOT sales; TITLE 'Roofing Shingle Sales'; PROC SORT DATA = shingles2 OUT = shingles6; BY potentcat; RUN; PROC UNIVARIATE DATA = shingles6; VAR promotion; BY potentcat; RUN; PROC UNIVARIATE DATA = shingles2; VAR promotion; CLASS potentcat; RUN; PROC UNIVARIATE DATA = shingles TRIM = 5 WINSOR = 5 ROBUSTSCALE; VAR sales; PROC UNIVARIATE DATA = shingles TRIM = 10 WINSOR = 10 ROBUSTSCALE; VAR sales; RUN; PROC FORMAT; VALUE $trainfmt 'TRUE' = 'Training' 'FALS' = 'Test'; VALUE potfmt 1 = 'Low' 2 = 'Moderate' 3 = 'High'; RUN; PROC TABULATE DATA = shingles2; CLASS training pot; VAR sales; TABLE training = 'Sample Type' * pot = 'Sales Potential' , sales = 'Recent Sales' * (N MEAN STDDEV) / RTS=25 NOCONTINUED; FORMAT training $trainfmt. pot potfmt.; TITLE 'Sales Data by Region Potential and Training/Test Status'; RUN;