29.12.2013 Views

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

Base SAS 9.1.3 Procedures Guide - Acsu Buffalo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The TABULATE Procedure 4 Program 1281<br />

Program<br />

Set the <strong>SAS</strong> system options. The NODATE option suppresses the display of the date and time<br />

in the output. PAGENO= specifies the starting page number. LINESIZE= specifies the output<br />

line length, and PAGESIZE= specifies the number of lines on an output page.<br />

options nodate pageno=1 linesize=105 pagesize=60;<br />

Create the FUNDRAIS data set. FUNDRAIS contains data on student sales during a school<br />

fund-raiser. A DATA step creates the data set.<br />

data fundrais;<br />

length name $ 8 classrm $ 1;<br />

input @1 team $ @8 classrm $ @10 name $<br />

@19 pencils @23 tablets;<br />

sales=pencils + tablets;<br />

datalines;<br />

BLUE A ANN 4 8<br />

RED A MARY 5 10<br />

GREEN A JOHN 6 4<br />

RED A BOB 2 3<br />

BLUE B FRED 6 8<br />

GREEN B LOUISE 12 2<br />

BLUE B ANNETTE . 9<br />

RED B HENRY 8 10<br />

GREEN A ANDREW 3 5<br />

RED A SAMUEL 12 10<br />

BLUE A LINDA 7 12<br />

GREEN A SARA 4 .<br />

BLUE B MARTIN 9 13<br />

RED B MATTHEW 7 6<br />

GREEN B BETH 15 10<br />

RED B LAURA 4 3<br />

;<br />

Create the PCTFMT. format. The FORMAT procedure creates a format for percentages. The<br />

PCTFMT. format writes all values with at least one digit, a blank, and a percent sign.<br />

proc format;<br />

picture pctfmt low-high=’009 %’;<br />

run;<br />

Specify the title.<br />

title "Fundraiser Sales";<br />

Create the report and specify the table options. The FORMAT= option specifies up to<br />

seven digits as the default format for the value in each table cell.<br />

proc tabulate format=7.;<br />

Specify subgroups for the analysis. The CLASS statement identifies Team and Classrm as<br />

class variables.<br />

class team classrm;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!