SAS OnlineTutor HomeFAQ PageSuggested Learning PathContents+Searchback||next

Creating Enhanced List and Summary Reports
Defining Variables


Using DEFINE Statements

To describe how to use and display variables in your report, you use one or more DEFINE statements. You can list DEFINE statements in any order, and you can list options (usages, attributes, and so on) in any order in a DEFINE statement.


General form, simple DEFINE statement:
DEFINE variable / <usage> <attribute(s)> <option(s)>
                <justification> <'column-heading'>
;

where

  • variable is the name of the variable that you want to define.

  • usage specifies how to use the variable. Valid options are ACROSS, ANALYSIS, COMPUTED, DISPLAY, GROUP, and ORDER.

  • attribute(s) specifies attributes for the variable, including FORMAT=, WIDTH=, and SPACING=.

  • option(s) specifies formatting options, including DESCENDING, NOPRINT, NOZERO, and PAGE.

  • <justification> specifies column justification (CENTER, LEFT, or RIGHT).

  • 'column-heading' specifies a label for the column heading.


Example

These DEFINE statements specify usages, attributes, options, justification, and column headings for the variables Flight and Orig. In this lesson, you'll look at each of these ways of defining variables.

     proc report data=flights.europe nowd;
        where dest in ('LON','PAR');
        column flight orig dest mail freight revenue;
        define flight / order descending 'Flight Number'
                        center width=6 spacing=5;
        define orig / 'Flight Origin' center width=6;
     run;

Let's start with attributes.


back||next


Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.

Terms of Use & Legal Information | Privacy Statement