SlideShare a Scribd company logo
SASTechies [email_address] http://www.sastechies.com
Creating SAS Tables,  Listings,  Basic Statistics Procedures with SAS  Graphs ODS HTML Proc Report and Other Utility Procedures 11/13/09 SAS Techies 2009 TLG’s
proc format;  value $repfmt 'TFB'='Bynum' 'MDC'='Crowley' 'WKK'='King'; value cntyfmt 12='Durham' 45='Wake' 13='Orange'; run;   proc print data=vcrsales;  var salesrep county unitsold; format salesrep  $ repfmt .  County cntyfmt . ; run;  11/13/09 SAS Techies 2009
title1 'Heart Rates for Patients with'; title3 'Increased Stress Tolerance Levels';   In  SAS listing output , title line 2 appears blank  In  HTML output , title lines simply appear consecutively, without extra spacing to indicate skipped title numbers.  TITLE < n>   ' title-text ';     where  n  is a number from 1 to 10 that specifies the title line, and  'title-text'  is the actual title to be displayed.  The maximum title length depends on your operating environment and the value of the linesize=option Title statement is global and additive Cancelling titles A TITLE statement remains in effect until you modify it, cancel it, or end your SAS session.  Redefining a title line cancels any higher-numbered title lines.  To cancel all previous titles, specify a null TITLE statement  11/13/09 SAS Techies 2009 Heart Rates for Patients with Increased Stress Tolerance Levels Obs RestHR MaxHR RecHR 2 68 171 133 3 78 177 139 8 70 167 122 11 65 181 141 14 74 152 113 15 75 158 108 20 78 189 138
FOOTNOTE < n>   ' footnote-text ';      where  n  is a number from 1 to 10 that specifies the footnote line, and  footnote-text  is the actual footnote to be displayed.  The maximum footnote length depends on your operating environment and the value of the LINESIZE= option.  Be sure to match quotation marks that enclose the footnote text. Footnote statement is global and additive 11/13/09 SAS Techies 2009 Obs RestHR MaxHR RecHR 2 68 171 133 3 78 177 139 8 70 167 122 11 65 181 141 14 74 152 113 15 75 158 108 20 78 189 138 Data from Treadmill Tests 1st Quarter Admissions
how to create single plots and overlaid plots, then refine the plots by scaling axes, defining plotting symbols, and specifying methods of interpolating plotted points.  GPLOT procedure   PROC   GPLOT   DATA= SAS-data-set ;          PLOT   vertical-variable*horizontal-variable ; RUN;   11/13/09 SAS Techies 2009
proc gplot data=clinic.totals2000; plot newadmit*month; run;  PLOT   vertical-variable*horizontal-variable   /              VAXIS= <value-list | range>             HAXIS= <value-list | range > ;   Ex.  vaxis=10 to 100 by 10  11/13/09 SAS Techies 2009
PLOT   vertical-variable-1*horizontal-variable             vertical-variable-2*horizontal-variable   /    OVERLAY;   If the OVERLAY option were not specified, each plot request would generate a separate graph  SYMBOL statement  is used   to enhance your plots by specifying plotting symbols, plot lines, color, and interpolation.  Interpolation is a technique for estimating values between plot points and drawing lines to connect the points. 11/13/09 SAS Techies 2009 proc gplot data=clinic.totals2000;  plot  therapy*month   treadmill*month  /  overlay ;  run;  |<--pair1-->| |<---pair2--->|
symbol1 color=red value=star interpol=spline   height=1 cm width=4;  proc gplot data=clinic.totals2000;  plot therapy*month; run;  11/13/09 SAS Techies 2009 symbol1 color=red value=star interpol=spline height=1 cm width=4;  symbol2 color=green value=plus interpol=spline height=1 cm width=4;    VALUE=   plotting symbol   HEIGHT=   height of the plotting symbol   INTERPOL=     interpolation technique   WIDTH=   thickness of the line in pixels   COLOR=   color of plotting symbols or lines 
Setting Plotting Symbols  The  VALUE=  (or  V= ) option specifies the plotting symbol that represents each data point. Possible values for the VALUE= option include  the letters  A  through  W   the numbers  0  through  9   a number of special symbols including  PLUS ,  STAR ,  SQUARE ,  DIAMOND ,  TRIANGLE , and many others  NONE , which produces a plot with no symbols for data points.  11/13/09 SAS Techies 2009
Setting Plotting Symbol Height  You can use the  HEIGHT=  (or  H= ) option to specify the height of the plotting symbol. You can specify a value for height and a unit of measurement. Valid units are  percentage of the display area ( PCT )  inches ( IN )  centimeters ( CM )  points ( PT )  character cells ( CELL ), which is the default unit.  11/13/09 SAS Techies 2009 symbol1 value=triangle  height=1 cm  color=black;
symbol1 value=triangle  interpol=none ;  Specifying Connecting Lines  To specify whether or not to connect plotted points, you use the  INTERPOL=  (or  I= ) option in the SYMBOL statement. Connecting lines can be straight lines, smoothed lines, or vertical lines drawn from plotted points to a horizontal line at zero or the minimum value on the Y axis.  Possible values include  NONE ,  JOIN ,  NEEDLE ,  SPLINE ,  HILO ,  STD , and more.  11/13/09 SAS Techies 2009
  SYMBOL statements are both  global  and  additive . This means that  once defined, they remain in effect until you change/cancel/or end the SAS session  within one SYMBOL statement, you can change the value of one option value without affecting the values of other options.  Ex: symbol1 value=square color=blue interpol=needle;  symbol1 v=triangle;  11/13/09 SAS Techies 2009
Canceling SYMBOL Statement Options   an individual option   symbol1 interpol=join  color=yellow  width=1.5;  symbol1  color=;   all options  in one SYMBOL statement  symbol1 interpol=join color=yellow width=2 value=square;  symbol2  interpol=join color=blue width=2 value=star;  symbol2;   - Submitting the null SYMBOL2 statement cancels the SYMBOL2 statement but does not affect higher or lower numbered SYMBOL statements.  all SYMBOL statements  currently in effect.  cancel all SYMBOL statements in effect by submitting statement:  goptions reset=symbol;   When you cancel a SYMBOL statement option, you return the option to its default value.  11/13/09 SAS Techies 2009
symbol1 value=triangle interpol=none color=red; proc gplot data=clinic.totals2000; plot newadmit*month;  run;  quit; To end the procedure, you must submit another PROC step, a DATA step, or a QUIT statement (shown below). quit;  Not all procedures support RUN-group processing, and implementation varies.  11/13/09 SAS Techies 2009
11/13/09 SAS Techies 2009 symbol1 interpol=spline value=none color=red;  symbol2 interpol=spline value=none color=blue;  proc gplot data=clinic.therapy1999;  plot swim*month aerclass*month/overlay;  where swim>35 and aerclass>35;  run;
proc gplot data=air.airqual;  plot avgtsp*month =state  /  vminor=3 hminor=0   areas=2 nolegend;   pattern1 color=red;   pattern2 color=blue;   note move=(10, 19)  color=red 'Alabama'; note move=(10, 20) color= blue  'California';   symbol1 c=red i=spline v=none;  symbol2 c=blue i=spline v=none;  where state in (&quot;CA&quot; , &quot;AL&quot;);  quit;  11/13/09 SAS Techies 2009
PROC GCHART  < DATA= SAS-data-set > ;          chart-form   chart-variable  </  options > ; RUN;   SAS-data-set  is the name of the SAS data set to be used. chart-form  is  HBAR, HBAR3D, VBAR, VBAR3D, PIE, or PIE3D.  The  chart-form  specifies a 2D or 3D horizontal bar chart, vertical bar chart, or pie chart, respectively. chart-variable  is the variable that determines the number of bars or pie slices.  The default statistic for  GCHART is FREQ (frequency).  11/13/09 SAS Techies 2009
proc gchart data=clinic.insure;  hbar company; run;  PROC GCHART  < DATA= SAS-data-set > ;          chart-form   chart-variable   /   TYPE= statistic ; RUN;   QUIT; Statistics include CFREQ  (cumulative frequency),  PERCENT  (percent), and  CPERCENT  (cumulative percent).  For  horizontal bar charts , unless otherwise specified, PROC GCHART also displays the statistics  CFREQ   PERCENT , and  CPERCENT CFREQ  and CPERCENT  are  NOT available for pie charts . 11/13/09 SAS Techies 2009
proc gchart data=clinic.insure; vbar company /  sumvar=balancedue ; run;  SUMVAR= option  to summarize a variable within categories. When you specify SUMVAR=, the default statistic is  SUM , so the chart displays the total of the values of the summary variable for each unique value of the chart variable. When you use SUMVAR=, you can also use TYPE=. However, the value of TYPE=   can be only  SUM  or  MEAN .  11/13/09 SAS Techies 2009 proc gchart data=clinic.insure;  vbar company / sumvar=balancedue  type=mean ;
proc gchart data=clinic.insure;  vbar company / sumvar=balancedue type=mean  patternid=midpoint ; run;  enhance your charts by specifying  patterns  other than the default values for bars or slices.  PATTERNID= <BY | MIDPOINT | GROUP | SUBGROUP> where  BY ,  MIDPOINT ,  GROUP , or  SUBGROUP  specify that bar colors and/or patterns vary according to the option specified.  You cannot use the PATTERNID=MIDPOINT option when you create pie charts. 11/13/09 SAS Techies 2009
proc gchart data=clinic.admit; hbar sex / sumvar=weight type=mean  group=actlevel patternid=group ; run; pattern1 color=lib ;  pattern2 color=lig ; proc gchart data=clinic.admit; hbar age / sumvar=weight type=mean  subgroup=sex patternid=subgroup  mean; run;  11/13/09 SAS Techies 2009
pie company / sumvar=balancedue type=mean  fill=x ;  FILL= <X|S> where  X  changes the fill pattern for all slices to hatch  S  changes the fill pattern for all slices to solid.  You cannot use the FILL= option with  bar charts. 11/13/09 SAS Techies 2009
proc gchart data=clinic.insure;  pie3d  company / sumvar=balancedue type=mean ctext=blue  explode= &quot;ACME&quot;; where Company in (&quot;ACME&quot;, &quot;RURITAN&quot;, &quot;USA INC.&quot;); run;  pattern1 color=lib;  pattern2 color=lig;  proc gchart data=clinic.admit;  hbar3d  age / sumvar=weight type=mean subgroup=sex patternid=subgroup mean; run;  11/13/09 SAS Techies 2009
To save graphs in a SAS catalog other than the default catalog, you use the  GOUT= option  in the  PROC statement  for the step that creates your graph. So, when you create charts, you specify GOUT= in the PROC GCHART statement. Ex: symbol1 interpol=spline value=none color=red;  symbol2 interpol=spline value=none color=blue;  proc gchart data=clinic.therapy1999  gout=newcat ;  vbar month / sumvar=swim type=sum;  hbar month / sumvar=aerclass type=sum;  where swim>35 and aerclass>35;  run;  11/13/09 SAS Techies 2009

More Related Content

PPT
Base SAS Statistics Procedures
PPT
SAS Macros
PPT
Basics Of SAS Programming Language
PPT
Utility Procedures in SAS
PPT
Data Match Merging in SAS
DOCX
SAS Programming Notes
PDF
Introduction to SQL
PPT
SAS Functions
Base SAS Statistics Procedures
SAS Macros
Basics Of SAS Programming Language
Utility Procedures in SAS
Data Match Merging in SAS
SAS Programming Notes
Introduction to SQL
SAS Functions

What's hot (20)

PPTX
SQL - DML and DDL Commands
PPT
INTRODUCTION TO SAS
PDF
Sas cheat
PPTX
Computer Science:Sql Set Operation
PDF
Introduction to R Programming
PPT
Les02 (restricting and sorting data)
PPT
SAS BASICS
PDF
Oracle SQL Basics
PPTX
SQL - Structured query language introduction
PPTX
Calculated Fields in Tableau
PDF
Sql tutorial
PPT
Introduction to structured query language (sql)
PPTX
Sql Basics And Advanced
PDF
SAS cheat sheet
PDF
Basics of SAS
PPTX
Data Management in R
PPTX
Proc SQL in SAS Enterprise Guide 4.3
PPT
SAS Macros part 1
DOCX
Base sas interview questions
SQL - DML and DDL Commands
INTRODUCTION TO SAS
Sas cheat
Computer Science:Sql Set Operation
Introduction to R Programming
Les02 (restricting and sorting data)
SAS BASICS
Oracle SQL Basics
SQL - Structured query language introduction
Calculated Fields in Tableau
Sql tutorial
Introduction to structured query language (sql)
Sql Basics And Advanced
SAS cheat sheet
Basics of SAS
Data Management in R
Proc SQL in SAS Enterprise Guide 4.3
SAS Macros part 1
Base sas interview questions
Ad

Viewers also liked (13)

PPT
SAS Proc SQL
PPT
Reading Fixed And Varying Data
PPT
Box and whisker plots
PPT
SAS ODS HTML
PPT
Pp chapter 09 plots, graphs, and pictures revised
PPT
Arrays in SAS
PPT
SAS Access / SAS Connect
PPT
Improving Effeciency with Options in SAS
PPTX
Statistics & Probability in the Classrooms
PDF
Proc sql tips
PPT
Interviewing Basics
PDF
Approximating_probability_density_functions_for_the_Collective_Risk_Model
DOCX
Sas Macro Examples
SAS Proc SQL
Reading Fixed And Varying Data
Box and whisker plots
SAS ODS HTML
Pp chapter 09 plots, graphs, and pictures revised
Arrays in SAS
SAS Access / SAS Connect
Improving Effeciency with Options in SAS
Statistics & Probability in the Classrooms
Proc sql tips
Interviewing Basics
Approximating_probability_density_functions_for_the_Collective_Risk_Model
Sas Macro Examples
Ad

Similar to Sas Plots Graphs (20)

PDF
Learning SAS by Example -A Programmer’s Guide by Ron CodySolution
PDF
Graphing in SAS
PDF
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
PDF
DMAP Tutorial
PDF
BScPLSQL.pdf
PDF
Histograms: Pre-12c and now
PPT
e computer notes - Single row functions
PDF
Power of call symput data
PDF
Cpk problem solving_pcba smt machine
PDF
Ex32018.pdf
PPTX
PLSQLmy Updated (1).pptx
PPTX
Creating Maps With Style
PPTX
Basic Analysis using Python
PPT
JF608: Quality Control - Unit 3
PDF
Riyaj: why optimizer_hates_my_sql_2010
PDF
SAS_and_R.pdf
PPT
Oracle tips and tricks
PPT
Lecture 3
PDF
SD-GM Tutorial
PPT
Lecture05 abap on line
Learning SAS by Example -A Programmer’s Guide by Ron CodySolution
Graphing in SAS
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
DMAP Tutorial
BScPLSQL.pdf
Histograms: Pre-12c and now
e computer notes - Single row functions
Power of call symput data
Cpk problem solving_pcba smt machine
Ex32018.pdf
PLSQLmy Updated (1).pptx
Creating Maps With Style
Basic Analysis using Python
JF608: Quality Control - Unit 3
Riyaj: why optimizer_hates_my_sql_2010
SAS_and_R.pdf
Oracle tips and tricks
Lecture 3
SD-GM Tutorial
Lecture05 abap on line

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
cuic standard and advanced reporting.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
KodekX | Application Modernization Development
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
A Presentation on Artificial Intelligence
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
cuic standard and advanced reporting.pdf
Modernizing your data center with Dell and AMD
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KodekX | Application Modernization Development
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
“AI and Expert System Decision Support & Business Intelligence Systems”
NewMind AI Monthly Chronicles - July 2025
A Presentation on Artificial Intelligence
The AUB Centre for AI in Media Proposal.docx
Building Integrated photovoltaic BIPV_UPV.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Teaching material agriculture food technology

Sas Plots Graphs

  • 2. Creating SAS Tables, Listings, Basic Statistics Procedures with SAS Graphs ODS HTML Proc Report and Other Utility Procedures 11/13/09 SAS Techies 2009 TLG’s
  • 3. proc format; value $repfmt 'TFB'='Bynum' 'MDC'='Crowley' 'WKK'='King'; value cntyfmt 12='Durham' 45='Wake' 13='Orange'; run; proc print data=vcrsales; var salesrep county unitsold; format salesrep $ repfmt . County cntyfmt . ; run; 11/13/09 SAS Techies 2009
  • 4. title1 'Heart Rates for Patients with'; title3 'Increased Stress Tolerance Levels'; In SAS listing output , title line 2 appears blank In HTML output , title lines simply appear consecutively, without extra spacing to indicate skipped title numbers. TITLE < n> ' title-text ';     where n is a number from 1 to 10 that specifies the title line, and 'title-text' is the actual title to be displayed. The maximum title length depends on your operating environment and the value of the linesize=option Title statement is global and additive Cancelling titles A TITLE statement remains in effect until you modify it, cancel it, or end your SAS session. Redefining a title line cancels any higher-numbered title lines. To cancel all previous titles, specify a null TITLE statement 11/13/09 SAS Techies 2009 Heart Rates for Patients with Increased Stress Tolerance Levels Obs RestHR MaxHR RecHR 2 68 171 133 3 78 177 139 8 70 167 122 11 65 181 141 14 74 152 113 15 75 158 108 20 78 189 138
  • 5. FOOTNOTE < n> ' footnote-text ';     where n is a number from 1 to 10 that specifies the footnote line, and footnote-text is the actual footnote to be displayed. The maximum footnote length depends on your operating environment and the value of the LINESIZE= option. Be sure to match quotation marks that enclose the footnote text. Footnote statement is global and additive 11/13/09 SAS Techies 2009 Obs RestHR MaxHR RecHR 2 68 171 133 3 78 177 139 8 70 167 122 11 65 181 141 14 74 152 113 15 75 158 108 20 78 189 138 Data from Treadmill Tests 1st Quarter Admissions
  • 6. how to create single plots and overlaid plots, then refine the plots by scaling axes, defining plotting symbols, and specifying methods of interpolating plotted points. GPLOT procedure PROC GPLOT DATA= SAS-data-set ;         PLOT vertical-variable*horizontal-variable ; RUN; 11/13/09 SAS Techies 2009
  • 7. proc gplot data=clinic.totals2000; plot newadmit*month; run; PLOT vertical-variable*horizontal-variable /             VAXIS= <value-list | range>             HAXIS= <value-list | range > ; Ex. vaxis=10 to 100 by 10 11/13/09 SAS Techies 2009
  • 8. PLOT vertical-variable-1*horizontal-variable             vertical-variable-2*horizontal-variable /   OVERLAY; If the OVERLAY option were not specified, each plot request would generate a separate graph SYMBOL statement is used to enhance your plots by specifying plotting symbols, plot lines, color, and interpolation. Interpolation is a technique for estimating values between plot points and drawing lines to connect the points. 11/13/09 SAS Techies 2009 proc gplot data=clinic.totals2000; plot therapy*month treadmill*month / overlay ; run; |<--pair1-->| |<---pair2--->|
  • 9. symbol1 color=red value=star interpol=spline height=1 cm width=4; proc gplot data=clinic.totals2000; plot therapy*month; run; 11/13/09 SAS Techies 2009 symbol1 color=red value=star interpol=spline height=1 cm width=4; symbol2 color=green value=plus interpol=spline height=1 cm width=4;   VALUE=   plotting symbol   HEIGHT=   height of the plotting symbol   INTERPOL=     interpolation technique   WIDTH=   thickness of the line in pixels   COLOR=   color of plotting symbols or lines 
  • 10. Setting Plotting Symbols The VALUE= (or V= ) option specifies the plotting symbol that represents each data point. Possible values for the VALUE= option include the letters A through W the numbers 0 through 9 a number of special symbols including PLUS , STAR , SQUARE , DIAMOND , TRIANGLE , and many others NONE , which produces a plot with no symbols for data points. 11/13/09 SAS Techies 2009
  • 11. Setting Plotting Symbol Height You can use the HEIGHT= (or H= ) option to specify the height of the plotting symbol. You can specify a value for height and a unit of measurement. Valid units are percentage of the display area ( PCT ) inches ( IN ) centimeters ( CM ) points ( PT ) character cells ( CELL ), which is the default unit. 11/13/09 SAS Techies 2009 symbol1 value=triangle height=1 cm color=black;
  • 12. symbol1 value=triangle interpol=none ; Specifying Connecting Lines To specify whether or not to connect plotted points, you use the INTERPOL= (or I= ) option in the SYMBOL statement. Connecting lines can be straight lines, smoothed lines, or vertical lines drawn from plotted points to a horizontal line at zero or the minimum value on the Y axis. Possible values include NONE , JOIN , NEEDLE , SPLINE , HILO , STD , and more. 11/13/09 SAS Techies 2009
  • 13.   SYMBOL statements are both global and additive . This means that once defined, they remain in effect until you change/cancel/or end the SAS session within one SYMBOL statement, you can change the value of one option value without affecting the values of other options. Ex: symbol1 value=square color=blue interpol=needle; symbol1 v=triangle; 11/13/09 SAS Techies 2009
  • 14. Canceling SYMBOL Statement Options an individual option symbol1 interpol=join color=yellow width=1.5; symbol1 color=; all options in one SYMBOL statement symbol1 interpol=join color=yellow width=2 value=square; symbol2 interpol=join color=blue width=2 value=star; symbol2; - Submitting the null SYMBOL2 statement cancels the SYMBOL2 statement but does not affect higher or lower numbered SYMBOL statements. all SYMBOL statements currently in effect. cancel all SYMBOL statements in effect by submitting statement: goptions reset=symbol; When you cancel a SYMBOL statement option, you return the option to its default value. 11/13/09 SAS Techies 2009
  • 15. symbol1 value=triangle interpol=none color=red; proc gplot data=clinic.totals2000; plot newadmit*month; run; quit; To end the procedure, you must submit another PROC step, a DATA step, or a QUIT statement (shown below). quit; Not all procedures support RUN-group processing, and implementation varies. 11/13/09 SAS Techies 2009
  • 16. 11/13/09 SAS Techies 2009 symbol1 interpol=spline value=none color=red; symbol2 interpol=spline value=none color=blue; proc gplot data=clinic.therapy1999; plot swim*month aerclass*month/overlay; where swim>35 and aerclass>35; run;
  • 17. proc gplot data=air.airqual; plot avgtsp*month =state / vminor=3 hminor=0 areas=2 nolegend; pattern1 color=red; pattern2 color=blue; note move=(10, 19) color=red 'Alabama'; note move=(10, 20) color= blue 'California'; symbol1 c=red i=spline v=none; symbol2 c=blue i=spline v=none; where state in (&quot;CA&quot; , &quot;AL&quot;); quit; 11/13/09 SAS Techies 2009
  • 18. PROC GCHART < DATA= SAS-data-set > ;         chart-form chart-variable </ options > ; RUN; SAS-data-set is the name of the SAS data set to be used. chart-form is HBAR, HBAR3D, VBAR, VBAR3D, PIE, or PIE3D. The chart-form specifies a 2D or 3D horizontal bar chart, vertical bar chart, or pie chart, respectively. chart-variable is the variable that determines the number of bars or pie slices. The default statistic for GCHART is FREQ (frequency). 11/13/09 SAS Techies 2009
  • 19. proc gchart data=clinic.insure; hbar company; run; PROC GCHART < DATA= SAS-data-set > ;         chart-form chart-variable / TYPE= statistic ; RUN; QUIT; Statistics include CFREQ (cumulative frequency), PERCENT (percent), and CPERCENT (cumulative percent). For horizontal bar charts , unless otherwise specified, PROC GCHART also displays the statistics CFREQ PERCENT , and CPERCENT CFREQ  and CPERCENT  are NOT available for pie charts . 11/13/09 SAS Techies 2009
  • 20. proc gchart data=clinic.insure; vbar company / sumvar=balancedue ; run; SUMVAR= option to summarize a variable within categories. When you specify SUMVAR=, the default statistic is SUM , so the chart displays the total of the values of the summary variable for each unique value of the chart variable. When you use SUMVAR=, you can also use TYPE=. However, the value of TYPE= can be only SUM or MEAN . 11/13/09 SAS Techies 2009 proc gchart data=clinic.insure; vbar company / sumvar=balancedue type=mean ;
  • 21. proc gchart data=clinic.insure; vbar company / sumvar=balancedue type=mean patternid=midpoint ; run; enhance your charts by specifying patterns other than the default values for bars or slices. PATTERNID= <BY | MIDPOINT | GROUP | SUBGROUP> where BY , MIDPOINT , GROUP , or SUBGROUP specify that bar colors and/or patterns vary according to the option specified. You cannot use the PATTERNID=MIDPOINT option when you create pie charts. 11/13/09 SAS Techies 2009
  • 22. proc gchart data=clinic.admit; hbar sex / sumvar=weight type=mean group=actlevel patternid=group ; run; pattern1 color=lib ; pattern2 color=lig ; proc gchart data=clinic.admit; hbar age / sumvar=weight type=mean subgroup=sex patternid=subgroup mean; run; 11/13/09 SAS Techies 2009
  • 23. pie company / sumvar=balancedue type=mean fill=x ; FILL= <X|S> where X changes the fill pattern for all slices to hatch S changes the fill pattern for all slices to solid. You cannot use the FILL= option with bar charts. 11/13/09 SAS Techies 2009
  • 24. proc gchart data=clinic.insure; pie3d company / sumvar=balancedue type=mean ctext=blue explode= &quot;ACME&quot;; where Company in (&quot;ACME&quot;, &quot;RURITAN&quot;, &quot;USA INC.&quot;); run; pattern1 color=lib; pattern2 color=lig; proc gchart data=clinic.admit; hbar3d age / sumvar=weight type=mean subgroup=sex patternid=subgroup mean; run; 11/13/09 SAS Techies 2009
  • 25. To save graphs in a SAS catalog other than the default catalog, you use the GOUT= option in the PROC statement for the step that creates your graph. So, when you create charts, you specify GOUT= in the PROC GCHART statement. Ex: symbol1 interpol=spline value=none color=red; symbol2 interpol=spline value=none color=blue; proc gchart data=clinic.therapy1999 gout=newcat ; vbar month / sumvar=swim type=sum; hbar month / sumvar=aerclass type=sum; where swim>35 and aerclass>35; run; 11/13/09 SAS Techies 2009

Editor's Notes

  • #3: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #4: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #5: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #6: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #7: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #8: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #9: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #10: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #11: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #12: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #13: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #14: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #15: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #16: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #17: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #18: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #19: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #20: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #21: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #22: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #23: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #24: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #25: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005
  • #26: SASTechies.com Sharad C Narnindi Attic Technologies,Inc 2005