SAS Univariate plots
SAS help provides:
Example plots for line printer output
data Trans;
input Thick @@; ** stay on the same line to read next data;
label Thick = 'Plating Thickness (mils)';
datalines;
3.468 3.428 3.509 3.516 3.461 3.492 3.478 3.556 3.482 3.512
3.490 3.467 3.498 3.519 3.504 3.469 3.497 3.495 3.518 3.523
3.458 3.478 3.443 3.500 3.449 3.525 3.461 3.489 3.514 3.470
3.561 3.506 3.444 3.479 3.524 3.531 3.501 3.495 3.443 3.458
3.481 3.497 3.461 3.513 3.528 3.496 3.533 3.450 3.516 3.476
3.512 3.550 3.441 3.541 3.569 3.531 3.468 3.564 3.522 3.520
3.505 3.523 3.475 3.470 3.457 3.536 3.528 3.477 3.536 3.491
3.510 3.461 3.431 3.502 3.491 3.506 3.439 3.513 3.496 3.539
3.469 3.481 3.515 3.535 3.460 3.575 3.488 3.515 3.484 3.482
3.517 3.483 3.467 3.467 3.502 3.471 3.516 3.474 3.500 3.466
;
run;
title 'Analysis of Plating Thickness';
proc univariate data=Trans ;
histogram Thick; ** could add more variable names here;
run;
************************************************************;
**uniex09.sas;;
** lives in /netopt/SAS/SASFoundation/9.2/samples/base/ on hilbert ; ;
title 'Comparative Analysis of Lot Source';
proc univariate data=Channel noprint;
class Lot;
histogram Length / nrows = 3
intertile = 1
cprop
normal(noprint);
inset n = "N" / pos = nw;
run;
************************************************************;
**uniex10.sas;;
proc format ;
value mytime 1 = '2002' 2 = '2003';
data Disk;
input @1 Supplier $10. Year Width;
label Width = 'Opening Width (inches)';
format Year mytime.;
datalines;
Supplier A 1 1.8932
. . .
Supplier B 1 1.8986
Supplier A 2 1.8978
. . .
Supplier B 2 1.8997
;
title 'Results of Supplier Training Program';
proc univariate data=Disk noprint;
class Supplier Year / keylevel = ('Supplier A' '2003');
histogram Width / intertile = 1.0
vaxis = 0 10 20 30
ncols = 2
nrows = 2;
run;
************************************************************;
**uniex09.sas;;
title 'FET Channel Length Analysis';
proc univariate data=Channel noprint;
histogram Length / kernel(c = 0.25 0.50 0.75 1.00
l = 1 20 2 34
noprint);
run;
************************************************************;
**uniex17.sas;;
symbol v=plus;
title 'Normal Quantile-Quantile Plot for Hole Distance';
proc univariate data=Sheets noprint;
qqplot Distance / normal(mu=est sigma=est color=red l=2)
square;
run;
Example 24.2 Using Box Plots to Compare Groups
data Times;
informat Day date7. ;
format Day date7. ;
input Day @ ;
do Flight=1 to 25;
input Delay @ ;
output;
end;
datalines;
16DEC88 4 12 2 2 18 5 6 21 0 0 0 14 3 . 2 3 5 0 6 19 7 4 9 5 10
17DEC88 1 10 3 3 0 1 5 0 . . 1 5 7 1 7 2 2 16 2 1 3 1 31 5 0
18DEC88 7 8 4 2 3 2 7 6 11 3 2 7 0 1 10 2 3 12 8 6 2 7 2 4 5
19DEC88 15 6 9 0 15 7 1 1 0 2 5 6 5 14 7 20 8 1 14 3 10 0 1 11 7
20DEC88 2 1 0 4 4 6 2 2 1 4 1 11 . 1 0 6 5 5 4 2 2 6 6 4 0
21DEC88 2 6 6 2 7 7 5 2 5 0 9 2 4 2 5 1 4 7 5 6 5 0 4 36 28
22DEC88 3 7 22 1 11 11 39 46 7 33 19 21 1 3 43 23 9 0 17 35 50 0 2 1 0
23DEC88 6 11 8 35 36 19 21 . . 4 6 63 35 3 12 34 9 0 46 0 0 36 3 0 14
24DEC88 13 2 10 4 5 22 21 44 66 13 8 3 4 27 2 12 17 22 19 36 9 72 2 4 4
25DEC88 4 33 35 0 11 11 10 28 34 3 24 6 17 0 8 5 7 19 9 7 21 17 17 2 6
26DEC88 3 8 8 2 7 7 8 2 5 9 2 8 2 10 16 9 5 14 15 1 12 2 2 14 18
;
run;
proc means data=Times noprint;
var Delay;
by Day;
output out=Cancel nmiss=ncancel; ** count number of canceled flights;
data Times;
merge Times Cancel;
by Day;
run;
data Weather; ** why were they late?;
informat Day date7. ;
format Day date7. ;
length Reason $ 16 ;
input Day Flight Reason & ;
datalines;
16DEC88 8 Fog
17DEC88 18 Snow Storm
17DEC88 23 Sleet
21DEC88 24 Rain
21DEC88 25 Rain
22DEC88 7 Mechanical
22DEC88 15 Late Arrival
24DEC88 9 Late Arrival
24DEC88 22 Late Arrival
;
run;
data Times;
merge Times Weather;
by Day Flight;
run;
** Boxplots;
symbol1 v=plus;
symbol2 v=square;
symbol3 v=triangle;
title 'Box Plot for Airline Delays';
proc boxplot data=Times;
plot Delay*Day = ncancel / nohlabel symbollegend = legend1;
legend1 label = ('Cancellations:');
label Delay = 'Delay in Minutes';
run;
goptions reset=symbol;
Alternatively, use ODS graphics. Then horizontal is an option.
title 'Box Plot for Airline Delays';
proc boxplot data=Times;
plot Delay*Day /
boxstyle = schematic
horizontal;
label Delay = 'Delay in Minutes';
run;
ods graphics off;
What is SAS/IML(R) Studio? Only runs on MSWindows.
Author:
Jim Robison-Cox
Last Updated: