notes11 - 1 1 Notes 11: Multiple Observations per Record...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: 1 1 Notes 11: Multiple Observations per Record Writing to Multiple SAS Data Sets 2 Multiple Observations Per Record • A raw data file contains each employee’s identification number and this year’s contribution to his or her retirement plan. Each record contains information for multiple employees. E00973 1400 E09872 2003 E73150 2400 E45671 4500 E34805 1980 3 Desired Output • The output SAS data set should have one observation per employee. EmpID Contrib E00973 1400 E09872 2003 E73150 2400 E45671 4500 E34805 1980 4 Processing: What Is Required? E00973 1400 E09872 2003 E73150 2400 Read for Obs. 1 Process Other Statements Output Read for Obs. 2 Process Other Statements Output Read for Obs. 3 Process Other Statements Output 5 The Double Trailing @ • The double trailing @ holds the raw data record across iterations of the DATA step until the line pointer moves past the end of the line. INPUT var1 var2 var3 … @@ ; INPUT var1 var2 var3 … @@ ; 6 The Double Trailing @ data work.retire; length EmpID $ 6; infile ‘retire.dat'; input EmpID $ Contrib @@; run; Hold until end of record. 2 7 NOTE: 2 records were read from the infile 'retire.dat'. The minimum record length was 35. The maximum record length was 36. NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.RETIRE has 5 observations and 2 variables. Creating Multiple Observations Per Record Partial Log The "SAS went to a new line" message is expected because the @@ option indicates that SAS should read until the end of each record. 8 EmpID Contrib E00973 1400 E09872 2003 E73150 2400 E45671 4500 E34805 1980 Creating Multiple Observations Per Record proc print data=retire noobs; run; PROC PRINT Output 9 Trailing @ Versus Double Trailing @ Holds raw data records in the input buffer until SAS reads past the end of the line. Double trailing @ INPUT var-1 ... @@; Holds raw data record until 1) an INPUT statement with no trailing @ 2) the bottom of the DATA step. Trailing @ INPUT var-1... @; Effect Option 10 A Forecasting Application • The growth rate of each division of an airline is forecast in st.growth . If each of the five divisions grows at its respective rate for the next three years, what will be the approximate size of each division at the end of each of the three years? • Partial Listing of st.growth Num Division Emps Increase APTOPS 205 0.075 FINACE 198 0.040 FLTOPS 187 0.080 11 A Forecasting Application • The output SAS data set, forecast , should contain 15 observations. • Partial Listing of forecast New Division Increase Year Total APTOPS 0.075 1 220.38 APTOPS 0.075 2 236.90 APTOPS 0.075 3 254.67 FINACE 0.040 1 205.92 FINACE 0.040 2 214.16 12 Implicit Output • By default, every DATA step contains an implicit OUTPUT statement at the end of each iteration. This implicit OUTPUT statement tells the SAS System to write observations to the data set or data sets that are created....
View Full Document

This note was uploaded on 10/31/2011 for the course STAT 440 taught by Professor Muyot,m during the Fall '08 term at University of Illinois, Urbana Champaign.

Page1 / 9

notes11 - 1 1 Notes 11: Multiple Observations per Record...

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

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