Resources

Creating Line Plots

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: GRSERIES                                            */
/*   TITLE: Creating Line Plots                                 */
/* PRODUCT: IML                                                 */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: Rick Wicklin                UPDATE: SEP 2013        */
/*     REF:                                                     */
/*    MISC:                                                     */
/*                                                              */
/****************************************************************/


proc iml;
x = do(-5, 5, 0.1);
y1 = pdf("Normal", x, 0, 1);

title "Series Plot with Default Properties";
run Series(x, y1);

title "Series Plot with Groups and Reference Lines";
y2 = pdf("Normal", x, 0, 1.5);
g = repeat({1,2}, 1, ncol(x));   /* 1,1,1,...,2,2,2 */
x = x  || x ;
y = y1 || y2;

call Series(x, y) group=g                 /* assign color/marker shape */
                 other="refline -2 2 / axis=x"   /* add reference line */
                 grid={X Y}
                 label={"X" "Normal Density"}
                 xvalues=-4:4
                 yvalues=do(0,0.4,0.05);