Lecture4 - Chapter 7 Reading Delimited Raw Data Files 7.1 Using Standard Delimited Data as Input 7.2 Using Nonstandard Delimited Data as Input 1

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

View Full Document Right Arrow Icon
1 Chapter 7: Reading Delimited Raw Data Files 7.1 Using Standard Delimited Data as Input 7.2 Using Nonstandard Delimited Data as Input
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 Use the DATA step to create a SAS data set from a delimited raw data file. Examine the compilation and execution phases of the DATA step when reading a raw data file. Explicitly define the length of a variable by using the LENGTH statement.
Background image of page 2
3 Business Scenario An existing data source contains information on Orion Star sales employees from Australia and the United States. A new SAS data set needs to be created that contains a subset of this existing data source. This new SAS data set must contain the following: only the employees from Australia who are Sales Representatives the employee’s first name, last name, salary, job title, and hired date labels and formats in the descriptor portion
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 Reading SAS Data Sets Reading Excel Worksheets Reading Delimited Raw Data Files Business Scenario
Background image of page 4
5 Reading SAS Data Sets Reading Excel Worksheets Reading Delimited Raw Data Files Business Scenario data ; infile ; input ; ... run; libname ; data ; set ; ... run; libname ; data ; set ; ... 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 sales.csv Partial sales.csv 120102,Tom,Zhou,M,108255,Sales Manager,AU,11AUG1969,06/01/1989 120103,Wilson,Dawes,M,87975,Sales Manager,AU,22JAN1949,01/01/1974 120121,Irenie,Elvish,F,26600,Sales Rep. II,AU,02AUG1944,01/01/1974 120122,Christina,Ngan,F,27475,Sales Rep. II,AU,27JUL1954,07/01/1978 120123,Kimiko,Hotstone,F,26190,Sales Rep. I,AU,28SEP1964,10/01/1985 120124,Lucian,Daymond,M,26480,Sales Rep. I,AU,13MAY1959,03/01/1979 120125,Fong,Hofmeister,M,32040,Sales Rep. IV,AU,06DEC1954,03/01/1979 120126,Satyakam,Denny,M,26780,Sales Rep. II,AU,20SEP1988,08/01/2006 120127,Sharryn,Clarkson,F,28100,Sales Rep. II,AU,04JAN1979,11/01/1998 120128,Monica,Kletschkus,F,30890,Sales Rep. IV,AU,14JUL1986,11/01/2006 120129,Alvin,Roebuck,M,30070,Sales Rep. III,AU,22NOV1964,10/01/1985 120130,Kevin,Lyon,M,26955,Sales Rep. I,AU,14DEC1984,05/01/2006 120131,Marinus,Surawski,M,26910,Sales Rep. I,AU,25SEP1979,01/01/2003 120132,Fancine,Kaiser,F,28525,Sales Rep. III,AU,05APR1949,10/01/1978 120133,Petrea,Soltau,F,27440,Sales Rep. II,AU,22APR1986,10/01/2006 120134,Sian,Shannan,M,28015,Sales Rep. II,AU,06JUN1949,01/01/1974 120135,Alexei,Platts,M,32490,Sales Rep. IV,AU,26JAN1969,10/01/1997 comma delimited
Background image of page 6
7 Business Scenario Syntax Use the following statements to complete the scenario: DATA output-SAS-data-set ; LENGTH variable(s) $ length ; INFILE ' raw-data-file-name ' ; INPUT specifications ; KEEP variable-list ; LABEL variable = ' label ' variable = ' label ' variable = ' label ' ; FORMAT variable(s) format ; RUN;
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 The DATA statement begins a DATA step and provides the name of the SAS data set being created. The DATA statement can create temporary or permanent data sets. INFILE ' raw-data-file-name ' ; INPUT specifications ; < additional SAS statements > RUN; The DATA Statement (Review)
Background image of page 8
9 The INFILE Statement The INFILE statement identifies the physical name of the raw data file to read with an INPUT statement. The physical name is the name that the operating environment uses to access the file. DATA output-SAS-data-set ; INPUT specifications ; < additional SAS statements > RUN;
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 The INFILE Statement Examples: Windows infile ‘P: \Math2871\sales.csv'; UNIX infile ‘/users/ userid /sales.csv'; z/OS (OS/390) infile '.workshop.rawdata(sales)';
Background image of page 10
11 The INPUT Statement The INPUT statement describes the arrangement of values in the raw data file and assigns input values to the corresponding SAS variables.
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.

This note was uploaded on 06/12/2011 for the course ASB 1001,2522, taught by Professor Nicole during the One '09 term at University of New South Wales.

Page1 / 132

Lecture4 - Chapter 7 Reading Delimited Raw Data Files 7.1 Using Standard Delimited Data as Input 7.2 Using Nonstandard Delimited Data as Input 1

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