General Syntax
proc sgplot data=sashelp.class;
scatter x=height y=weight;
ellipse x=height y=weight / type=predicted
run;
proc sgpanel data=sashelp.heart noautolegend;
title "Cholesterol Distribution";
panelby sex;
histogram cholesterol;
density cholesterol;
run;
|
Basic Types
Basic |
scatter, series, step, band, needle, vector |
Fit and confidence |
loess, regression, penalized B-Spline curves, ellipses |
Distribution |
box plots, histograms, normal and kernel density estimates |
Categorization |
dot plots, bar charts, line plots |
Basic and Fit and confidence plots may be used together, otherwise different categories must not be mixed. Box plots cannot be combined.
Plot Axes
Axis Statements |
XAXIS, X2AXIS, YAXIS, Y2AXIS |
Axis Types |
Discrete, Linear, Logarithmic, Time |
General Options
LEGENDLABEL=, NAME=, TRANSPARENCY=
|
Marker Symbols
Set via MARKERATTRS= option
Line Patterns
Set via LINEATTRS= option
PROC sgplot DATA=
[NO]CYCLEATTRS, DESCRIPTION=, NOAUTOLEGEND, TMPLOUT=, UNIFORM=[GROUP | SCALE | ALL]
|
SCATTER X= Y=
DATALABEL=, ERRORBARATTRS=, FREQ=, MARKERATTRS=, MARKERCHAR=, MARKERCHARATTRS=, NOMISSINGGROUP, , XERRORLOWER=, XERRORUPPER=, YERRORLOWER=, YERRORUPPER=, GROUP=
|
SERIES X= Y=
BREAK, CURVELABEL[=], CURVELABELPOS=[MIN | MAX | START | END], DATALABEL[=], LINEATTRS=, MARKERATTRS=, MARKERS, NOMISSINGGROUP, GROUP=
|
STEP X= Y=
BREAK, CURVELABEL[=], CURVELABELPOS= [MIN | MAX | START | END], DATALABEL[=], ERRORBARATTRS=, JUSTIFY= [LEFT | CENTER | RIGHT], LINEATTRS=, MARKERATTRS=, MARKERS, NOMISSINGGROUP, YERRORLOWER=, YERRORUPPER=, GROUP=
|
BAND [X|Y]= UPPER= LOWER=
FILL | NOFILL, FILLATTRS=, LINEATTRS=, MODELNAME=, NOEXTEND, NOMISSINGGROUP, OUTLINE | NOOUTLINE, GROUP=
|
Creates a band that highlights part of the plot.
NEEDLE Statement
BASELINE=, DATALABEL[=], LINEATTRS=, MARKERATTRS=, MARKERS, NOMISSINGGROUP, URL=, GROUP=
|
Creates a plot with needles connecting each point to the baseline.
VECTOR X= Y=
ARROWDIRECTION= [OUT | IN | BOTH], ARROWHEADSHAPE=, DATALABEL[=], LINEATTRS=, NOARROWHEADS, NOMISSINGGROUP, XORIGIN=, YORIGIN=, GROUP=
|
Creates a vector plot that draws arrows from a point of origin to each data point.
LOESS X= Y=
ALPHA=, CLM[=], CLMATTRS=, CLMTRANSPARENCY=, CURVELABEL[=], CURVELABELLOC= [OUTSIDE | INSIDE], CURVELABELPOS= [MIN | MAX | START | END], DATALABEL[=], DEGREE= [1 | 2], INTERPOLATION= [CUBIC | LINEAR], LINEATTRS=, MARKERATTRS=, MAXPOINTS=, NOLEGCLM, NOLEGFIT, NOMARKERS, REWEIGHT=, SMOOTH=, WEIGHT=, GROUP=
|
Creates a fitted loess curve.
REG X= Y=
ALPHA=, CLI[=], CLIATTRS=, CLM[=], CLMATTRS=, CLMTRANSPARENCY=, CURVELABEL[=], CURVELABELLOC=[OUTSIDE | INSIDE], CURVELABELPOS=[MIN | MAX | START | END], DATALABEL[=], DEGREE=, FREQ=, LINEATTRS=, MARKERATTRS=, MAXPOINTS=, NOLEGCLI, NOLEGCLM, NOLEGFIT, NOMARKERS, WEIGHT=, GROUP=
|
Creates a fitted regression line or curve.
PBSPLINE X= Y=
ALPHA=, CLI[=], CLIATTRS=, CLM[=], CLMATTRS=, CLMTRANSPARENCY=, CURVELABEL[=], CURVELABELLOC=[OUTSIDE | INSIDE], CURVELABELPOS=[MIN | MAX | START | END], DATALABEL[=], DEGREE=, FREQ=, LINEATTRS=, MARKERATTRS=, MAXPOINTS=, NKNOTS=, NOLEGCLI, NOLEGCLM, NOLEGFIT, NOMARKERS, SMOOTH=, WEIGHT=, GROUP=
|
Creates a fitted penalized B-spline curve.
ELLIPSE X= Y=
ALPHA=, CLIP, FILL | NOFILL, FILLATTRS=, FREQ=, LINEATTRS=, OUTLINE | NOOUTLINE, TYPE = MEAN | PREDICTED
|
Adds a confidence or prediction ellipse to another plot.
[H|V]BOX response variable
BOXWIDTH=, CATEGORY=, DATALABEL[=], EXTREME, FREQ=, LABELFAR, MISSING, PERCENTILE=, SPREAD
|
Creates a horizontal / vertical box plot that shows the distribution of your data.
DENSITY response variable
FREQ=, LINEATTRS=, SCALE=, TYPE= [NORMAL | KERNEL]
|
Creates a density curve that shows the distribution of values in your data.
HISTOGRAM response variable
BOUNDARY= LOWER | UPPER, FILL | NOFILL, FILLATTRS=, FREQ=, OUTLINE | NOOUTLINE, SCALE= [COUNT | PERCENT | PROPORTION], SHOWBINS
|
Creates a histogram that displays the frequency distribution of a numeric value.
DOT category variable
ALPHA=, DATALABEL[=], FREQ=, LIMITATTRS=, LIMITS= [BOTH | LOWER | UPPER], LIMITSTAT= [CLM | STDDEV | STDERR], MARKERATTRS=, MISSING, NOSTATLABEL, NUMSTD=, RESPONSE=, STAT= [FREQ | MEAN | SUM], WEIGHT=
|
Creates a dot plot that summarizes the values of a category variable.
[H|V]BAR category variable
ALPHA=, BARWIDTH=, DATALABEL, FILL | NOFILL, FILLATTRS=, FREQ=, LIMITATTRS=, LIMITS= [BOTH | LOWER | UPPER], LIMITSTAT= CLM | STDDEV | STDERR, MISSING, NOSTATLABEL, NUMSTD=, OUTLINE | NOOUTLINE, RESPONSE=, STAT= [FREQ | MEAN | SUM], WEIGHT, GROUP=
|
Creates a bar chart that summarizes the values of a category variable.
[H|V]LINE category variable
ALPHA=, BREAK, CURVELABEL, CURVELABELPOS= [MIN | MAX |START | END], DATALABEL[=], FREQ=, LIMITATTRS=, LIMITS= [BOTH | LOWER | UPPER], LIMITSTAT= [CLM | STDDEV | STDERR], LINEATTRS=, MARKERATTRS=, MARKERS, MISSING, NOSTATLABEL, NUMSTD=, RESPONSE=, STAT= [FREQ | MEAN | SUM], URL=, WEIGHT=, GROUP=
|
Creates a horizontal / vertical line plot (the line is vertical / horizontal). You can use the [H|V]LINE statement with the [H|V]BAR statement to create a bar-line chart.
|
|
PANELBY variable(s)
BORDER | NOBORDER, COLHEADERPOS=[TOP | BOTTOM | BOTH], COLUMNS=, LAYOUT= [LATTICE | PANEL | ROWLATTICE | COLUMNLATTICE], MISSING, NOVARNAME, ONEPANEL, ROWHEADERPOS=[RIGHT | LEFT | BOTH], ROWS=, SPACING=, SPARSE, START= TOPLEFT | BOTTOMLEFT, UNISCALE= ROW | ALL
|
May only be used with proc sgpanel.
|
|
|