| Working with SAS Data Sets |
You can use the VAR clause to select a set of variables. The general form of the VAR clause is as follows:
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, as in the following
statement:
> 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, as in the following
statements:
> 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 |
| APPEND | specifies which IML variables contain data to append to the data set |
| CREATE | specifies the variables to go in the data set |
| EDIT | limits which variables are accessed |
| LIST | specifies which variables to list |
| READ | specifies which variables to read |
| REPLACE | specifies which data set variable's data values to replace with corresponding IML variable data values |
| USE | limits which variables are accessed |
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.