- Introduction to Procedures
- Sorting and Running a
`proc`by Subgroups - Numerical Summaries
- Graphical Summaries

proc print;This automatically uses the data set from the previous

proc print data=a;explicitly uses the data set

proc means; . . . output out = newname . . . ;This explicitly creates the data set

output out=d1 a=a1 b=b1 c=c1;with

proc sort; by trt; proc means; by trt;will first sort the data by treatment

proc sort; by sex trt; proc means; by sex trt;Sorting is cheap. It is a good idea to always run

NOTE: While you can get separate printed listings for each treatment (in

proc univariate; /* detailed univariate summaries */ var x y; /* for variables x and y */ output out=b mean=mx std=sx; /* create set b with mean and SD for x only */ proc means; /* means, SDs, min, max for each variable var x y; /* for variables x and y */ output out=b mean=mx my std=sx sy;/* output means and SD for x and y */ proc means noprint; /* useful form if you do not want printout */ var x y; output out=b mean=mx my std=sx sy;/* output means and SD for x,y */

proc univariate plot normal; /* histogram type summaries */ var x;The

proc plot; /* scatter plot */ plot y*x; /* plot y vertical and x horizontal */ plot y*x='*'; /* use "*" as plotting symbol */ plot y*z=trt; /* use value of trt as plotting symbol */ plot y*x='*' y*z / overlay; /* overlay two plots on same page */Here is a way to construct Interaction Plots. It gives you a plot of the average values of

proc sort; by period trt; proc means noprint; by period trt; var y; output out=means mean=my; proc plot; plot my*period=trt;The

Here is a fancier way to construct Interaction Plots and some
Diagnostic Plots, which allows you
to use the ful value of statistical modelling. The basic idea is to
fit the desired model, save the least squares means
(`lsmeans`) as a dataset, and print from that.
Diagnostic information is saved with the `output` phrase.

proc glm; class a b; model y = a | b; lsmeans a*b / out=lsm; output out=diag p=py r=ry; proc plot data=lsm; /* Interaction Plot */ plot lsmean*a=b; /* cell mean v. a by b */ plot lsmean*b=a; /* cell mean v. b by a */ proc plot data=diag; /* Diagnostic Plots */ plot y*py py*py='*' / overlay; /* observed v. predicted */ plot ry*py; /* residual v. predicted */Here is a way to keep

proc plot uniform; by location; plot y*x;You can set several plot features:

plot y*x / vaxis=10 to 100 by 5; /* vertical axis ticks */ plot y*x / haxis=10 to 20 by 2; /* horizontal axis ticks */ plot y*x / vzero hzero; /* include origin on plot */ plot ry*py / href=0; /* horizontal reference line */ plot y*x py*x='*' / overlay; /* overlay two plots */

goptions device=tek4014; data biplot; set results; if _type_ = 'SCORE' then do; text = substr(_name_,4,5); end; if _type_ = 'CORR' then do; text = substr(_name_,1,3); end; x = prin1; y = prin2; z = prin3; xsys = '2'; ysys = '2'; zsys = '2'; size = 1; label z = 'Dimension 3'; label y = 'Dimension 2'; label x = 'Dimension 1'; keep x y z text xsys ysys zsys size; proc gplot; title3 'BiPlot of Stimuli and Chemicals'; symbol1 v=none; plot y*x=1 / annotate=biplot frame href=0 vref=0;The second example creates a 3-dimensional plot. The third example following takes data from file

goptions device=tek4014; proc g3d; plot y*x=z / tilt=45 rotate=45;

filename gsasfile 'hatps.dat'; goptions device=ps hsize=8.5 vsize=8.5 gaccess=gsasfile; proc g3d; plot y*x=z / tilt=45 rotate=45;

Return to U WI Statistics Home Page

Last modified: Sun Feb 25 19:17:58 1996 by Brian Yandell
Wed Feb 1 10:39:28 1995 by Stat Www
*(statwww@stat.wisc.edu)*