/* SAS/IML Studio program to analyze the length of indexes versus the length of the rest of the book. Data were gathered on three publishers. Rick Wicklin 12/13/2010. */ submit; DATA IndexPages; input Publisher $1-9 Author $10-31 Title $32-99 NumPages NumIndexPages; IndexRatio = NumIndexPages / NumPages; datalines; Springer Ramsay & Silverman Functional Data Analysis 403 8 Springer Venables & Ripley S Programming 254 8 Springer de Boeck & Wilson Explanatory Item Response Models 375 6 Springer Marshall & Olkin Life Distributions 762 12 Springer Keller, et. al. Monte Carlo and Quasi-Monte Carlo Methods 2006 447 0 Springer Devroye, et. al. A Probabilistic Theory of Pattern Recognition 618 10 Springer Cabrera & McDougall Statistical Consulting 384 6 Springer Kaas, et. al. Modern Actuarial Risk Theory: Using R 370 11 Springer Unwin, et. al. Graphics of Large Datasets 261 5 Springer Wilkinson The Grammar of Graphics 696 7 Springer Simonoff Smoothing Methods in Statistics 320 10 Wiley Agresti Categorical Data Analysis (2nd Edition) 654 10 Wiley Fleming & Harrington Counting Process and Survival Analysis 416 9 Wiley Gnanadesikan Methods for Statistical Data Analysis of Multivariate Observations 341 7 Wiley Nauck et al. Foundations of Neuro-Fuzzy Systems 302 3 Wiley Searle Matrix Algebra Useful for Statistics 431 6 Wiley Depuis & Ellis A Weak Convergence Approach to the Theory of Large Deviations 468 11 Wiley Lumley Complex Surveys 267 6 SAS Press Prairie The Essential PROC SQL Handbook for SAS Users 541 28 SAS Press Lafler PROC SQL: Beyond the Basics using SAS 347 16 SAS Press Allison Survival Analysis Using SAS System 281 10 SAS Press Allison Fixed Effects Regression Methods for Longitudinal Data Using SAS 141 5 SAS Press Dmitrienko, et. el. Pharmaceutical Statistics Using SAS 428 15 SAS Press Cody Learning SAS by Example: A Programmer's Guide 699 26 SAS Press Bailer Statistical Programing in SAS 426 18 SAS Press Wicklin Statistical Programing with SAS/IML Software 440 11 ; run; proc sort data=IndexPages out=IndexPages; BY Publisher NumPages; run; endsubmit; /* Read data into data object to create dynamically linked graphs */ declare DataObject dobj; dobj = DataObject.CreateFromServerDataSet("work.IndexPages"); dobj.SetMarkerShape(OBS_ALL, MARKER_CIRCLE); dobj.SelectObsWhere("Author", WHERE_EQ, "Wicklin"); dobj.SetMarkerShape(MARKER_X); declare ScatterPlot plot; plot = ScatterPlot.Create(dobj, "NumPages", "NumIndexPages"); plot.SetAxisLabel(XAXIS, "Number of Pages"); plot.SetAxisLabel(YAXIS, "Number of Index Pages"); plot.SetTitleText("Relative Size of Index, by Publisher", true); plot.SetGraphAreaBackgroundColor(WHITE); plot.SetMarkerSize(8); plot.DrawUseDataCoordinates(); colors = {0 0 255, /** SAS **/ 255 204 60, /** Springer **/ 0 128 64}; /** Wiley **/ colors = RGBToInt(colors); run ColorCodeObsByGroups( dobj, "Publisher", colors); dobj.SetMarkerOutlineColor(OBS_ALL, BLACK); /* Run ROBUSTREG to fit robust regression lines for each publisher. Use a no-intercept model */ submit; proc robustreg data=IndexPages method=LTS; by Publisher; model NumIndexPages = NumPages / noint; output out=RobustOut P=P; run; endsubmit; /* read results into SAS/IML vectors */ use RobustOut; read all var {"Publisher" "P" "NumPages"}; close RobustOut; /* for each publisher, draw lines */ ux = unique(Publisher); do i = 1 to ncol(ux); idx = loc(Publisher=ux[i]); plot.DrawSetPenAttributes(colors[i], SOLID, 2); plot.DrawLine( NumPages[idx], P[idx] ); end; /* add legend and other reference annotations */ run DrawLegend(plot, ux, 12, colors, SOLID, MARKER_CIRCLE, WHITE, "ILT" ); plot.DrawSetTextAlignment(ALIGN_LEFT, -1); plot.DrawText(440, 13.25, "Statistical Programming with SAS/IML Software"); plot.ShowReferenceLines();