Lecture9 - Chapter 16: Reading Raw Data Files 16.1 Reading...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Chapter 16: Reading Raw Data Files 16.1 Reading Raw Data Files with Formatted Input 16.2 Controlling When a Record Loads 16.3 Additional Techniques for List Input (Self-Study)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Objectives Read raw data in fixed columns using formatted input.
Background image of page 2
3 Business Scenario Read the Offers File The offers.dat raw data file contains information about discount offers. Create a SAS data set named discounts from the raw data. Partial offers.dat 1 1 2 2 1---5----0----5----0----5 104012/02/07 Outdoors15% 202010/07/07 Golf 7% 103009/22/07 Shoes 10% 103009/22/07 Clothes 10% 202007/08/07 Clothes 15% 203007/08/07 Clothes 25% Description Column Customer Type 1- 4 Offer Date 5-12 Item Group 14-21 Discount 22-24 Layout: offers.dat
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Business Scenario Desired Output The discounts data set should have one observation per input record. Partial Listing of discounts Cust_ type Offer_dt Item_gp Discount 1040 02DEC2007 Outdoors 0.15 2020 07OCT2007 Golf 0.07 1030 22SEP2007 Shoes 0.10 1030 22SEP2007 Clothes 0.10 . . 3010 17MAY2007 Clothes 0.15
Background image of page 4
5 The DATA Step to Read Raw Data (Review) To read raw data, the DATA step will include DATA, INFILE, and INPUT statements. DATA output-SAS-data-set ; INFILE ' raw-data-file-name ' ; INPUT specifications ; < additional SAS statements > RUN;
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 SAS Help Use SAS Help to navigate to Starting with Raw Data: The Basics. Page to Introduction to Raw Data and review this section. What are the three styles of input? List, column, and formatted are the three styles of input. Click the Contents tab and select: SAS Products Base SAS Step-by-Step Programming with Base SAS Software Getting Your Data into Shape Starting with Raw Data: The Basics
Background image of page 6
7 Which Input Style to Choose? Column input, formatted input, and list input are all styles of writing INPUT specifications . Style Used for Reading Column Input Standard data in fixed columns Formatted Input Standard and nonstandard data in fixed columns List Input Standard and nonstandard data separated by blanks or some other delimiter
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Standard and Nonstandard Data (Review) Standard data is data that SAS can read without any special instructions. Examples of standard numeric data: 58 -23 67.23 00.99 5.67E5 1.2E-2 Nonstandard data is any data that SAS cannot read without special instructions. Examples of nonstandard numeric data: 5,823 15% $67.23 01/12/1999 12MAY2006
Background image of page 8
9 Quiz Which style of INPUT specification should we pick to read the offers.dat raw data file? Partial offers.dat 1 1 2 2 1---5----0----5----0----5 104012/02/07 Outdoors15% 202010/07/07 Golf 7% 103009/22/07 Shoes 10% 103009/22/07 Clothes 10%
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Quiz Correct Answer Which style of INPUT specification should we pick to read the offers.dat raw data file? Partial offers.dat 1 1 2 2 1---5----0----5----0----5 104012/02/07 Outdoors15% 202010/07/07 Golf 7% 103009/22/07 Shoes 10% 103009/22/07 Clothes 10% Formatted input is the best style of INPUT specification to read this data. The offers.dat file is in fixed columns and has nonstandard data.
Background image of page 10
11 Reading Data Using Formatted Input General form of the INPUT statement with formatted input: INPUT pointer-control variable informat . . . ; Formatted input is used to read data values by moving the input pointer to the starting position of the field naming the variable specifying an informat.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 184

Lecture9 - Chapter 16: Reading Raw Data Files 16.1 Reading...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online