Reading Selected Variables
Overview of Reading Selected Variables
You can create a subset
of a larger data set not only by excluding observations but also by
specifying which variables you want the new data set to contain. In
a DATA step, you can use the SET statement and the KEEP= or DROP=
data set options (or the DROP and KEEP statements) to create a subset
from a larger data set by specifying which variables you want the
new data set to include.
Keeping Selected Variables
This example uses the KEEP= data
set option in the SET statement to read only the variables that represent
the services-related expenditures of the data set CITY.
data services; set city(keep=Year ServicesTotal ServicesPolice ServicesFire
ServicesWater_Sewer)
; run; proc ...
Get Step-by-Step Programming with Base SAS 9.4 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.