Beruflich Dokumente
Kultur Dokumente
Aidan McDermott,
May 2, 2006
1
Destination Examples:
Destination
Produces
listing
output
Listing output
SAS datasets
HTML
printer
latex
HTML output
Postscript, pdf,
LaTeX source
This is somewhat
reminiscent of variable
values and formats. 6
PDF output
Producing HTML
10
HTML example
11
12
ODS
HTML example
ods html
file = body.htm
contents= contents.htm
page= page.htm
frame= frame.htm;
13
14
Log
HTML example
ods html file = odshtml-body.htm
contents=odshtml-contents.htm
page=odshtml-page.htm
frame=odshtml-frame.htm;
ods select BasicMeasures Quantiles;
proc univariate data=infant;
var rate98 rate99;
title;
run;
ods html close;
15
HTML example
HTML example
18
Default destination
20
URLs
ods html body=c:\records\data.html
contents= c:\records\toc.html
frame=c:\records\frame.html;
/* Open HTML */
ods html body=measutes-body.htm
contents=measures-contents.htm
frame=measures-frame.htm;
proc print data=measures noobs
headings=horizontal;
title Output dataset produced from univariate;
run;
/*Reset the destinations to their defaults */
ods html close;
ods listing ;
toc.html contains a
reference to
c:\records\data.html
frame.html contains a
reference to
c:\records\toc.html
and
c:\records\data.html
21
URLs
Path option
22
23
24
Style
style=brick;
Other styles:
beige, brick, brown, D3D,
default, minimal
25
Example
26
Example
27
Example
28
Example
29
30
33
34
Graph basics
GOPTIONS
Graphic control
37
PROC GOPTIONS
38
GOPTIONS
GOPTIONS options-list
ROTATE= portrait or landscape
(will override the setting in the print dialog
box)
proc goptions;
run;
Can also type goptions at the command
line
40
Data
36 observations in all
42
Charts
Examples
Look for graphic elements in each chart
Look for common data types
Look for similarities among the examples
43
44
45
46
47
48
49
50
Charts
All the examples used a small number of
graphic elements
Main difference between plots is the
polygon/area type
Most involved a categorical/discrete
variable and a numeric variable.
A histogram uses a continuous variable to
create categories. The counts of a categorical
variable can be used to create the numeric
variable.
51
Proc GCHART
52
data ca88air;
set vol1.ca88air(where=(station=SFO));
54
VBAR
separate bar chart for each chart
variable
/
/
/
/
/
56
options;
options;
options;
options;
options;
run;
57
VBAR SYNTAX
58
VBAR
midpoints are the values of the chart
variable that identify categories of data.
By default, midpoints are selected or
calculated by the procedure. The way
the procedure handles the midpoints
depends on whether the values of the
chart variable are character, discrete
numeric, or continuous numeric.
character chart variables- separate bar
is drawn for each value
59
60
10
VBAR
VBAR OPTIONS
61
62
VBAR OPTIONS
VBAR OPTIONS
VBAR SYNTAX
Other options;
DISCRETEseparate bar for each value of
numeric variable
TYPE=statistic specifies the chart statistic.
FREQ frequency
PCT
percentage
SUM
sum (the default)
MEAN mean
CLM=confidence-level draws chart confidence
intervals (error bars)
64
GLOBAL STATEMENTS
define titles, footnotes
SUMVAR=variable
specifies variable to used for sum or mean
calculations for each midpoint. The
resulting statistics are represented by
the length of the bars along the response
axis, and they are displayed at major tick
marks. REQUIRED if specifying TYPEMEAN or SUM.
66
11
GLOBAL STATEMENTS
TITLE STATEMENT
TITLE
AXIS
defines titles
defines appearance of axes
FOOTNOTE
defines footnotes
PATTERN
LEGEND
defines legends
SYMBOL
NOTE
Title syntax
PATTERN STATEMENT
HEIGHT=
specifies the height of text
H=n<units> characters in number of units
JUSTIFY=
J=R|L|C
PATTERN STATEMENT
OPTIONS
fill
empty
solid
left slanting lines
right slanting lines
crosshatched lines
is 1-5
1 indicating the lightest
71
72
12
Exporting graphs
Make sure the graphics window has focus,
by clicking on it.
File export as Image
select type of image gif,
open other software program Powerpoint
insert picture
73
74
Saving graphs
PROC GPLOT
goptions replace;
libname mylib c:\Temp\sasclass\myfiles;
proc gchart data=mydat gout=lib.mygraphs;
run-group processing
- procedure does not end with a run
- submit new statements and produce
more graphs without another PROC
- ends with QUIT or PROC or DATA
76
Proc GPLOT
produces two-dimensional graphs that
plot one variable against another within
a set of coordinate axes
graphs are automatically scaled to the
values of your data, although scaling
can be controlled with options or with
AXIS statements.
scatterplots, bubble plots plots, plots
with interpolated lines (SYMBOL
statement)
77
20
Tick Marks
10
Values
HORIZONTAL AXIS
X variable
78
13
GPLOT SYNTAX
GPLOT SYNTAX
Graphics options on PLOT statement
CTEXT= color
LEGEND= LEGENDn
vertical*horizontal e.g.
PLOT y*x;
HAXIS=AXISn
(uses nth global AXIS statement)
vertical*horizontal=variable e.g.
PLOT y*x=z;
VAXIS=AXISn
(uses nth global AXIS statement)
79
80
which produces:
81
82
83
84
14
85
86
87
88
89
90
15
91
92
93
94
16