Graph Plotting
Date & Time: July 5, 10:15am
Location: 4576 Yonge Street Unit #408
Presenter: Sam Lam
Website: www.SASCrunch.com
Email: klam@sascrunch.com
Toll-Free: 1-888-818-4950
1
TOPICS
Histogram o Vertical Histogram o Horizontal Histogram o Statistics options o Subgroup
Axis
o Order o Label o Major / Minor o Offset o Value
Title / Footnote
Legend
o Across o CBorder o FWidth o Label o Value o Position
Pie Chart
Scattered Plot o Line Graph o Regression Line o Box Plot o STD
2
Topics
PROC GChart
Usage: Plot Histogram and Pie Chart
Basic Structure
Proc Gchart Data=Meetup.car; vbar group;
Run;
Quit;
Additional options: TYPE=Freq, cFreq, Percent, cPercent
Proc Gchart Data=Meetup.car; vbar group / type = percent;
Run;
Quit;
Additional options: TYPE=Sum, Mean
Proc Gchart Data=Meetup.car; vbar group / type = mean sumvar=price;
Run;
Quit;
Additional options: INSIDE / OUTSIDE
Proc Gchart Data=Meetup.car; vbar group / type = cfreq outside=freq;
Run;
Quit;
3
Additional options: DESCENDING
Proc Gchart Data=Meetup.car; vbar group / type = percent outside=freq descending;
Run;
Quit;
Additional options: WIDTH
Proc Gchart Data=Meetup.car; vbar group / type = percent width = 20;
Run;
Quit;
Additional options: SUBGROUP
Proc Gchart Data=Meetup.car; vbar group / subgroup = gender;
Run;
Quit;
Horizontal Histogram
Proc Gchart Data=Meetup.car; hbar group;
Run;
Quit;
4
AXIS
Usage: Control the display of axis
Basic Structure axis2 value = ("Eco" "Lux" "Spo");
Proc Gchart Data=Meetup.car; vbar group / subgroup = gender raxis=axis1 maxis=axis2;
Run;
Quit;
*Raxis = Response Axis, Maxis = Mid-point Axis
Additional options: ORDER, LABEL, MAJOR, MINOR axis1 order
Label
Major
Minor
=
=
=
=
(0 to 100 by 10)
(a=90 h=2 c=orange f="Courier" "Freq")
(h=1 w=2 c=red) none; Additional options: VALUE, OFFSET axis2 value = ("Eco" "Lux" "Spo") offset = (10);
Title, Footnotes title "Economy vs. Luxury vs. Sports Car: Histogram"; footnote1 "Note: Statistics taken from STAT CANADA";
5
LEGEND
Usage: Control legend displayed
Basic Structure legend1 ACROSS = 1;
Proc Gchart Data=Meetup.car; vbar group / subgroup = gender legend = legend1;
Run;
Quit;
Additional options: ACROSS, CBORDER, FWIDTH, LABEL, VALUE, POSITION legend1 ACROSS = 1 cBORDER = Black
FWIDTH = 2
LABEL = (h=1 "Gender")
Value = (h=0.5 "Female" "Male")
Position = (Buttom Center Outside);
Pie Chart
Proc Gchart Data=Meetup.car; pie group;
Run;
Quit;
Additional Options: TYPE, SUMVAR
Proc Gchart