Prerequisites
Before continuing with this section, you should understand the concepts that are
presented in the following sections:
Chapter 4, “Starting with Raw Data: The Basics,” on page 51
Chapter 6, “Starting with SAS Data Sets,” on page 91
Chapter 19, “Merging SAS Data Sets,” on page 289
Chapter 20, “Updating SAS Data Sets,” on page 317
Input SAS Data Set for Examples
This section looks at examples from an inventory tracking system that is used by a tool
vendor. The examples use the SAS data set INVENTORY as input. The data set contains
these variables:
PartNumber
is a character variable that contains a unique value that identifies each item.
Description
is a character variable that contains the text description of each item.
InStock
is a numeric variable that contains a value that describes how many units of each tool
the warehouse has in stock.
ReceivedDate
is a numeric variable that contains the SAS date value that is the day for which
InStock values are current.
Price
is a numeric variable that contains the price of each item.
The following program creates and displays the INVENTORY_TOOL data set:
data inventory_tool;
input PartNumber $ Description $ InStock @17
ReceivedDate date9. @27 Price;
format ReceivedDate date9.;
datalines;
K89R seal 34 27jul2010 245.00
M4J7 sander 98 20jun2011 45.88
LK43 filter 121 19may2011 10.99
MN21 brace 43 10aug2012 27.87
BC85 clamp 80 16aug2012 9.55
NCF3 valve 198 20mar2012 24.50
KJ66 cutter 6 18jun2010 19.77
UYN7 rod 211 09sep2010 11.55
JD03 switch 383 09jan2013 13.99
BV1E timer 26 03aug2013 34.50
;
run;
proc print data=inventory_tool;
336 Chapter 21 Modifying SAS Data Sets

Get Step-by-Step Programming with Base SAS 9.4, Second Edition, 2nd Edition 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.