HOME Module List Site Index About This Site glossary" Resources Innovative Technology Center UT Statistics Courses
Using SAS Choose Design ANOVA Compare Means Regression Examples
Using SAS Using SAS: Table of Contents

Basic procedures
PROC Print

Use the PRINT procedure to display dataset contents in the Results Viewer Window.
This is commonly done to visually check data integrity, for example after reading in a dataset or after some complex data manipulation.

The simplest code is
PROC PRINT
;
RUN;

which prints all contents of the most recently created dataset.
    example

To print a specific dataset, use
PROC PRINT DATA=one; RUN;
which prints all contents of DATA one.
    example

To limit the columns (variables) printed, list the ones to be printed.
PROC PRINT DATA=one;
VAR block treat weight;
RUN;

    example

To limit the number of rows(observations), use this syntax.
PROC PRINT DATA=one(OBS=5);
RUN;
which prints only the first 5 observations.
    example

If you want the output to be separated by groups, such as treatment, use the BY statement. A header will be printed for each group.
PROC SORT; BY treatment;
PROC PRINT; BY treatment;
RUN;

Generally the dataset would be sorted by the same variable, as shown. But if your dataset is in the desired order, then
proc print; by treatment notsorted; run;
will produce output in treatment groups in the order they are read from the dataset.
    example

To further separate the output, printing each treatment on a different page, use PAGEBY.
PROC PRINT; BY treatment;
PAGEBY treatment;
RUN;
Separating output within and between pages can be done, for example
PROC PRINT; BY treatment rep;
PAGEBY treatment;
RUN;
will have one treatment per page, and each page will have sections for each rep.
    example

 

Related Topics:                                                                                                     Using SAS: Table of Contents
PROC Print
PROC Sort
PROC Means
PROC Univariate

Home | Contact us | Module list & summary | Glossary/Terms | About this site | Stats courses | Links | Index