Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Working with SAS Data Sets

Selecting a Set of Variables

You can use the VAR clause to select a set of variables. The general form of the VAR clause is

VAR operand

where operand can be specified using one of the following: The following examples show each possible way you can use the VAR clause:
  var {time1 time5 time9};  /* a literal giving the variables */
  var time;                  /* a matrix containing the names */
  var('time1':'time9');                    /* an expression   */
  var _all_;                                     /* a keyword */
For example, to list students' names from the CLASS data set, use the VAR clause with a literal:
   > list point p var{name};

                OBS NAME
             ------ --------
                  2 THOMAS
                  4 JANE
                  9 BARBARA
To list AGE, HEIGHT, and WEIGHT, you can use the VAR clause with a matrix giving the variables:
   > v={age height weight};
   > list point p var v;

              OBS       AGE    HEIGHT    WEIGHT
           ------ --------- --------- ---------
                2   11.0000   57.5000   85.0000
                4   12.0000   59.8000   84.5000
                9   13.0000   65.3000   98.0000

The VAR clause can be used with the following statements for the tasks described:

Statement VAR Clause Function
APPENDspecifies which IML variables contain data to append to the data set
CREATEspecifies the variables to go in the data set
EDITlimits which variables are accessed
LISTspecifies which variables to list
READspecifies which variables to read
REPLACEspecifies which data set variable's data values to replace with corresponding IML variable data values
USElimits which variables are accessed

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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