O'Reilly logo

Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

title 'Tool Warehouse Inventory';
run;
The following output displays the INVENTORY_TOOL data set:
Figure 21.1 The INVENTORY_TOOL Data Set
Modifying a SAS Data Set: The Simplest Case
You can use the MODIFY statement to replace all values for a specific variable or
variables in a data set. The syntax for using the MODIFY statement for this purpose is
MODIFY SAS-data-set;
In the following program, the price of each part in the inventory is increased by 15%.
The new values for PRICE replace the old values on all records in the original
INVENTORY_TOOL data set. The FORMAT statement in the print procedure writes the
price of each item with two-digit decimal precision.
data inventory_tool;
modify inventory_tool;
price=price+(price*.15);
run;
proc print data=inventory_tool;
title 'Tool Warehouse Inventory';
title2 '(Price reflects 15% increase)';
format price 8.2;
run;
Modifying a SAS Data Set: The Simplest Case 337

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required