0.1 0.2 Introduction...........................................................................Error! Bookmark not defined. A Section Title .......................................................................Error! Bookmark not defined.
Demonstration: ............................... Error! Bookmark not defined. Exercises ................................................................................... Error! Bookmark not defined.
0.3 0.4
Chapter Summary .................................................................Error! Bookmark not defined. Solutions ...............................................................................Error! Bookmark not defined.
Solutions to Exercises ............................................................... Error! Bookmark not defined. Solutions to Student Activities (Polls/Quizzes) .......................... Error! Bookmark not defined.
3-2
Chapter 3 Summarizing Data
3.1 Creating an Accumulating Total Variable
3-3
3.1 Creating an Accumulating Total Variable
Objectives
Explain how SAS initializes the value of a variable in the PDV. Prevent reinitialization of a variable in the PDV. Create an accumulating variable.
3
Business Scenario
A retail manager for Orion Star Sportswear asked to see her department’s daily sales for April, as well as a month-to-date total for each day.
Create a new data set, mnthtot, that includes the month-to-date total (Mth2Dte) for each day.
Partial Listing of mnthtot
SaleDate 01APR2007 02APR2007 03APR2007 04APR2007 05APR2007 Sale Amt 498.49 946.50 994.97 564.59 783.01 Mth2Dte 498.49 1444.99 2439.96 3004.55 3787.56
4
3-4
Chapter 3 Summarizing Data
Input Data
The SAS data set orion.aprsales contains daily sales data from the Orion Star Sportswear department. Partial Listing of orion.aprsales
SaleDate 01APR2007 02APR2007 03APR2007 04APR2007 05APR2007 06APR2007 07APR2007 SaleAmt 498.49 946.50 994.97 564.59