Working with SAS Data Sets


Select a Set of Variables

You can use the VAR clause to select a set of variables. For example, the following statements list students’ names from the Sashelp.Class data set:

varNames = {Name Sex Age};
p = {3 6 9};
use Sashelp.Class;
list point p var varNames;

Figure 7.8: Listing Specific Variables and Observations

   OBS Name     Sex       Age                                                   
------ -------- --- ---------                                                   
     3 Barbara  F     13.0000                                                   
     6 James    M     12.0000                                                   
     9 Jeffrey  M     13.0000