Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

Chapter 4. Sorting, Printing, and Summar... > Selected Standard Formats - Pg. 106

Sorting, Printing, and Summarizing Your Data 106 Here are the data, where the students' names are followed by their classroom, the date they turned in their money, the type of candy sold: mint patties or chocolate dinosaurs, and the number of boxes sold: Adriana Nathan Matthew Claire Caitlin Ian Chris Anthony Stephen Erika 21 14 14 14 21 21 14 21 14 21 3/21/2000 3/21/2000 3/21/2000 3/22/2000 3/24/2000 3/24/2000 3/25/2000 3/25/2000 3/25/2000 3/25/2000 MP CD CD CD CD MP CD MP CD MP 7 19 14 11 9 18 6 13 10 17 The following program reads the raw data and computes Profit. The FORMAT statement in the PRINT procedure associates the DATE9. format with the variable DateReturned and the DOL- LAR6.2 format with the variable Profit: DATA sales; INFILE 'c:\MyRawData\Candy.dat'; INPUT Name $ 1-11 Class @15 DateReturned MMDDYY10. CandyType $ Quantity; Profit = Quantity * 1.25; PROC PRINT DATA = sales; VAR Name DateReturned CandyType Profit; FORMAT DateReturned DATE9. Profit DOLLAR6.2; TITLE 'Candy Sale Data Using Formats'; RUN; Here are the results: