Using SAS s PROC GPLOT to plot data and lins PROC GPLOT crats publication quality color graphics which can asily b xportd into documnts, prsntations, tc. To xport th graphs for futur us click on fil, xport. In th dialog box choos a fil nam and fil typ (*.mf works wll for putting graphs in word documnts or powrpoint prsntations) 1 proc gplot options; 2 titln options txt ; 2.a n = titl lvl 1-1 2.b c = color (black, rd, grn, blu, yllow, cyan, tc) 2.c f = font (swiss, simplx, script, italic, zapf, tc.) 2.d h = hight (dcimal valu, g 1,.5, 2, tc.) 3 symboln options; 3.a n = symbol numbr 1 to 255 3.b c = color (black, rd, grn, blu, yllow, cyan, tc) of symbol and intrpolation lin. 3.b.1 cv = color of symbol 3.b.2 ci = color of intrpolation lin 3.c f = font (swiss, simplx, script, italic, zapf, tc.) 3.d w = width (in pixils,.g., 1, 2, 3, tc.) 3. h = hight (in clls, dcimal valu, g 1,.5, 2, tc.) 3.f l = lin (typ lin, 1=solid, 2-46 various dashd lins) 3.g v = valu (typ of symbol,.g. plus, x, star, squar, diamond, triangl, dot, circl) 3.h i = intrpolation option 3.h.1 i=non no lin conncting points 3.h.2 i = join points connctd by a straight lin 3.h.3 i = splin plot lin intrpolatd using a cubic spin 4 labl y = ylabl x = xlabl ; rnams variabls as thy appar on graph. 5 plot yvariabl*xvariabl=n./ options; 5.a plot y*x=n; plots y against x using symboln 5.b plot y*x=n1 r*s=n2; crats 2 (or mor) sparat plots. 5.c plot y*x=n1 r*s=n2/ovrlay; puts plots on sam graph. 5.d plot y*x=n1 r*s=n2/ovrlay lgnd; puts plots on sam graph and adds lgnd. 5. plot y*x=n/hrf=5; plots y against x using symboln and puts vrtical rfrnc lin at x=5. 5.f plot y*x=n/hrf=5 lh=lintyp ch = color; lh spcifis typ of hrf lin (1-46), ch spcifis color of hrf lin. Can us vrf=c to spcify horizontal rfrnc lin, vh spcifis typ of vrf lin, cv spcifis color of vrf lin. 1
Som GPLOT xampls using th food xpnditur data data food; infil 'tabl5.2'; input y x; proc rg; modl y = x/p; output out=foodout p=yhat l95=lb u95=ub r=hat; Rad data, stimat rgrssion, obtain prdictd valus, crat output datast containing prdictd valus, 95% confidnc bands and rsiduals. * Exampl 1; symbol1 v=dot c=rd i=non h=.5; proc gplot data=foodout; labl y="food xpnditur" x="incom"; plot y*x=1; titl h=2 f=swiss "Exampl 1"; titl2 h=1.5 f=italic c=rd "Scattr diagram"; run; Exampl 1 plots data only using symbol1. labl statmnt changs what appars on axs. * Exampl 2; symbol2 v=dot c=rd i=non h=.5; symbol3 c=black i=join l=1 w=4; plot y*x=2 yhat*x=3/ovrlay lgnd; titl h=2 f=swiss "Exampl 2"; Exampl 2 plots data using symbol2 and fittd rgrssion lin using symbol3 * Exampl 3; symbol4 v=dot c=rd i=non h=.5; symbol5 c=black i=join l=1; symbol6 c=grn i=join l=2; plot y*x=4 yhat*x=5 lb*x=6 ub*x=6/ovrlay lgnd; titl h=2 f=swiss "Exampl 3"; titl3 h=1.5 f=italic c=rd "Confidnc bands includd"; Exampl 3 adds th confidnc bands using symbol6 * Exampl 4; symbol4 v=dot c=rd i=non h=.5; symbol5 c=black i=join l=1; symbol6 c=grn i=join l=2; plot y*x=4 yhat*x=5 lb*x=6 ub*x=6/ovrlay lgnd hrf=75 ch=purpl lh=3; titl h=2 f=swiss "Exampl 4"; titl3 h=1.5 f=italic c=rd "Confidnc bands & rfrnc lin includd"; Exampl 4 adds vrtical rfrnc lin at x=75, in th color purpl, using lintyp = 3 run; * run; 2
f o o d x p n d i t u r incom PLOT Pr di ct d Val u of 3
- PLOT Pr di ct d Val u of Lowr Bound of 95%C.I.(Individual Prd) Uppr Bound of 95%C.I.(Individual Prd) - PLOT Pr di ct d Val u of Lowr Bound of 95%C.I.(Individual Prd) Uppr Bound of 95%C.I.(Individual Prd) 4
Th graphs abov appar in color on your scrn, and if you hav a color printr thy will com out in color whn printd in a documnt, tc. In addition to th options illustratd abov thr ar options to add footnots to th graph, nots to th graph, of cours controlling color, siz, position, tc. SAS/GRAPH can produc bar charts pi charts maps 3-dimnsional graphs For many mor additional xampls us SAS s HELP mnu. whil in SAS click on HELP choos SAMPLE PROGRAMS doubl-click on SAS SAMPLE LIBRAR on th CONTENTS tab click on SAS/GRAPH slct an xampl. ou can copy th sampl cod and past it into th program window. Excut th fil to s what th program can do. Many of ths programs do quit tricky stuff. Don't gt boggd down in th dtails. ou can also visit th SAS wb sit: try http://www.sas.com/tchsup/download/sampl/readme for a list of sampls, of various typs, which you can download, not only for SAS/GRAPH but for rgrssion analysis and othr topics. 5