0% found this document useful (0 votes)
15 views3 pages

Stat 440 Lab Exercises 3

The document provides instructions for Statistics 440 lab exercises focusing on reading raw data using SAS. It includes two exercises: the first involves reading employee data while excluding the HireDate, and the second requires reading flight data with specific fields and formatting. Additionally, it instructs on using PROC PRINT and PROC CONTENTS to display data and its attributes.

Uploaded by

newtondr7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Stat 440 Lab Exercises 3

The document provides instructions for Statistics 440 lab exercises focusing on reading raw data using SAS. It includes two exercises: the first involves reading employee data while excluding the HireDate, and the second requires reading flight data with specific fields and formatting. Additionally, it instructs on using PROC PRINT and PROC CONTENTS to display data and its attributes.

Uploaded by

newtondr7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Statistics 440: Lab Exercises 3

Before you begin:


Login to Illinois Compass and download all of the files from the Data/Lab 3 folder. Save them in
‘D:\netid’ (or folder of your choice).

Exercise 1: Reading Raw Data Using Column Input


1. Write a DATA step to read the emplist raw data file using column input. Call the new SAS
data set work.emps. Write the DATA step so that the EmpID variable is read first and
HireDate is not read.
The complete record layout for the emplist raw data file is below.
You should read all of the fields except HireDate.

Variable Name Columns Data Type


LastName 1-20 Character
FirstName 21-30 Character
EmpId 31-35 Character
JobCode 36-43 Character
HireDate 44-51 Numeric
Salary 54-59 Numeric

2. Write a PROC PRINT step to view the data. Suppress the observation column.
SAS Partial Output

First
EmpID LastName Name JobCode Salary

E0029 TORRES JAN Pilot 50000


E0045 LANGKAMM SARAH Mechanic 80000
E0106 SMITH MICHAEL Mechanic 40000
E0116 LEISTNER COLIN Mechanic 36000
E0126 WADE KIRSTEN Pilot 85000
E0143 TOMAS HARALD Pilot 105000
E0204 WAUGH TIM Pilot 70000
E0206 LEHMANN DAGMAR Mechanic 64000
E0248 TRETTHAHN MICHAEL Pilot 100000
E0282 TIETZ OTTO Pilot 45000
E0288 O'DONOGHUE ART Mechanic 52000
E0304 WALKER THOMAS Pilot 95000

1
Statistics 440: Lab Exercises 3

Exercise 2: Reading Raw Data Using Formatted Input


This exercise instructs you to read some of the fields (identified by bold type in shaded rows
below) shown in the following record layout. The complete record layout for the sfosch raw
data file is shown below.

Variable Name Field Description Columns Data Type


FlightID Flight ID Number 1-7 Character

RouteID Route ID Number 8-14 Character


Origin Flight Origin 15-17 Character

Destination Flight Destination 18-20 Character

Model Aircraft Model 21-40 Character

Date Departure Date 41-49 Character


01JAN2000

DepartDay Departure Day of Week 51 Numeric


1=Sunday
FClassPass First Class Passengers 53-55 Numeric

BClassPass Business Class Passengers 57-59 Numeric


EClassPass Economy Class Passengers 61-63 Numeric

TotPassCap Aircraft Capacity – Total 65-67 Numeric


Passengers

CargoWt Weight of Cargo in Pounds 69-73 Numeric

CargoRev Revenue from Cargo in Dollars 75-79 Numeric

1. Create a permanent SAS data set named st.sanfran by writing a DATA step that uses
formatted input to create only the variables FlightID, RouteID, Destination,
Model, Date, and TotPassCap. Store the values of Date as SAS date values.

2. Use PROC PRINT to display the data portion of the data set. Display the values of Date in
the form 12/15/2000.

3. Use PROC CONTENTS to display the descriptor portion of the data set.

2
Statistics 440: Lab Exercises 3

Partial SAS Output


Alphabetic List of Variables and Attributes

# Variable Type Len

5 Date Num 8
3 Destination Char 3
1 FlightID Char 7
4 Model Char 20
2 RouteID Char 7
6 TotPassCap Num 8

Save your SAS program in a file.

______________________________________________________________________________
Portions Copyright  2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.
Reproduced with permission of SAS Institute Inc., Cary, NC, USA. SAS Institute Inc. makes no
warranties with respect to these materials and disclaims all liabilities thereof.

You might also like