UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS Graphics

Topics

Useful WebPages

Data set for this seminar

hsb2.sas7bdat: http://www.ats.ucla.edu/stat/sas/webbooks/reg/default.htm

1. Graph-N-Go

Graph-N-Go is mainly for reporting. Its strong point is in its flexibility to save a plot in various formats, including graphic format and html format. Its week point is that it only support a few graph types. We will show how to save a graph into a dynamic html format, so the graph can be modified later. We will also show how to save a graph in a graphic format.

    Menu: Solution-->Reporting-->Graph-N-Go

2. SAS/Insight

SAS/Insight is another package that can be used to explore variables and relationships among variables. Its strong point is that it offers a lot of good detailed information on variables, such univariate statistics. You can save all the graphs to gif files, or other graphic format files. But it is not easy to modify the style or the color of the graphs. Its interactive feature makes it strong for exploring data both graphically and analytically.

 

3. SAS/Analyst

SAS/Analyst tries to be both for exploring and reporting. It is a good place to start to have a look at the graphs that you are interested. There are many types of graphs that you can create and the best part of it is that it also creates the SAS code for generating the plots in case you want to change some of the settings or modify the code for other use. This is not only true for graphics, it is also true for statistical analyses.

4. SAS/Procs: Univariate, Boxplot, Gplot, Gchart, G3d to create customized more complex plots.

proc univariate data = hsb2 noprint;
histogram write;
run;
/*A better one of the same histogram.*/
proc univariate data = hsb2 noprint;
title "Histogram for variable write";
histogram write /cfill=ligr normal cframe=liy barwidth=8 cv=black;
inset mean std max min;
run;
title;

proc sort data = hsb2;
  by group;
run;
goptions reset = all;
proc boxplot data = hsb2;
  plot math*group;
run;

goptions reset = all;
axis1 value=("Group 1" "Group 2" "Group 3" "Group 4") label=('Group');
axis2 label = ('Math Score' a=90  justify=center);
proc boxplot data = hsb2;
  title1 'Boxplot of Math Score vs. group';
  plot math*group /boxconnect=mean boxstyle=schematic haxis=axis1 vaxis = axis2;
run;

goptions reset = all gunit=pct border cback=white
         colors=( blue green red black) ftext=swiss
         ftitle=swissb htitle=3 htext=3.5 ctitle=black ctext=black;
axis1 label=(a=90 'Mean for Variable Write') minor=none;

proc gchart data=hsb2;
 vbar group /sumvar=write axis=axis1
             ERRORBAR= bars width = 5 gspace=2 discrete
             type=mean cframe=ligr coutline= blue cerror=black;
run;
quit;
 
goptions reset = all;
symbol1 i = none c = blue v = dot w=1 pointlabel=("#id");
symbol2 i = none c = red v = dot;
proc gplot data = hsb2;
  plot write*math = 1 ;
where math > 60;
run;
quit;
symbol1 i = none c = blue v = diamond;
symbol2 i = none c = red v = triangle;
proc gplot data=hsb2;
  plot math*read =1 science*read =2 /overlay hminor=0 vminor=0;
run;
quit;
proc sort data= hsb2;
by read;
run;
symbol1 i = join v=star c=blue l = 1;
symbol2 i = join v=circle c=red l = 21;
proc glm data = hsb2;
 model write = read female female*read ;
 output out= pred p=pred;
run;
quit;
proc gplot data = pred;
  plot pred*read = female /overlay;
run;
quit;
proc g3d data= hsb2;
  scatter write*read =math;
run;
quit;  

5. Regression diagnostic plots

/*regression diagnostic plots from proc reg*/
proc reg data = hsb2 noprint;
  model write = female math ;
  plot rstudent.*predicted. / vref =(-3  3) vrefl=4 cvrefl=red;
  plot rstudent.*obs.;
  plot cookd.*predicted.;
  plot cookd.*obs.;
run;
quit;


How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California